Results 1 to 12 of 12

Thread: mod_rewrite part 2

  1. #1
    Roll Tide! mobilebadboy's Avatar
    Join Date
    Apr 2004
    Location
    Mobile, AL
    Posts
    428

    mod_rewrite part 2

    Ok, I've been giving myself a headache for the last couple of hours, and finally surrendered.

    I've got this line of my htaccess working:

    RewriteRule /([^./]+)/?$ /product.php?ASIN=$1

    When I add the following line, it works:

    RewriteRule /([^./]+)/?$ /olympus_cameras.php?Browse=493672&Sort=Sales&Page= $1

    But the first one quits working. It rewrites the URL, but it just refreshes the current page.

    Depending on where I move the 2nd line one or the other works. Say if I move the olympus line to the top, it quits working and then the product line works.

    And depending on how I change the olympus line, it often just gives me a blank white page with "No results found" and the return to the previous page link. But the product line works.

    I'm beginning to not like mod_rewrite.
    Shawn Kerr .com

  2. #2
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055
    I could recommend a non mod_rewrite solution.
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  3. #3
    Roll Tide! mobilebadboy's Avatar
    Join Date
    Apr 2004
    Location
    Mobile, AL
    Posts
    428
    Thanks, but after racking my brain for a few hours, and getting all but the one link to work, I'd realy to like to succeed with the mod_rewrite version. I can't let it beat me. And the rest of the site is running off rewrite, except for the pagination at the bottoms of the pages.
    Shawn Kerr .com

  4. #4
    Banned
    Join Date
    Dec 2003
    Posts
    152
    Try using the last [L] directive:

    RewriteRule /([^./]+)/?$ /product.php?ASIN=$1 [L}
    RewriteRule /([^./]+)/?$ /olympus_cameras.php?Browse=493672&Sort=Sales&Page= $1 [L}

  5. #5
    Banned
    Join Date
    Dec 2003
    Posts
    152
    Actually, you're probably going to need to specify more specifically matching regexps than "/([^./]+)/?$".

  6. #6
    Roll Tide! mobilebadboy's Avatar
    Join Date
    Apr 2004
    Location
    Mobile, AL
    Posts
    428
    Ok, I'm close. Everything is working...just not quite like I want though. Here's what I have:

    RewriteRule /([0-9]+)/?$ olympus_cameras\.php?Browse=493672&Sort=Sales&Page =$1 [L]
    RewriteRule /([^./]+)/?$ /product.php?ASIN=$1 [L]

    But, if you go to /olympus-cameras/2, then the URL looks like I want when you click on a product: /olympus-cameras/B0001DKQWI/.

    But if you go to /olympus-cameras/2/, then the URL looks like: /olympus-cameras/2/B0001DKQWI/.

    Which is good in a way, both /2/ and /2 work. I've tried messing around with it, but I'm scared to since I finally got it working for the most part. When I do, then only one or the other works.
    Shawn Kerr .com

  7. #7
    Junior Registered
    Join Date
    Dec 2003
    Posts
    4
    Quote Originally Posted by Chris
    I could recommend a non mod_rewrite solution.
    Would you mind sharing how you create the short url's in your aws sites?

    Does Google prefer shorter url's over longer url's ?

  8. #8

  9. #9
    Senior Member chromate's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    2,348
    Shorter URLs seem to get crawled faster.

  10. #10
    Junior Registered
    Join Date
    Dec 2003
    Posts
    4
    Don't see any mod_rewrite rules posted there though
    I'd rather stick to mod_rewrite.

  11. #11

  12. #12
    Registered Mike's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    2,755
    Quote Originally Posted by mirdin
    Don't see any mod_rewrite rules posted there though
    I'd rather stick to mod_rewrite.
    Yeah, but that's how Chris uses his short urls i think.
    Don't you just love free internet games ?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •