Forum Moderators: phranque

Message Too Old, No Replies

Mod re0write help

Second line is not working

         

blue_eagle

12:25 am on Sep 24, 2005 (gmt 0)

10+ Year Member



Hi there, I got this code :

RewriteEngine on
RewriteRule ^subaction/showfull/id/([0-9]+)/ucat/([0-9]+) /manufacturers/automobile/atv.php?subaction=showfull&id=$1&archive=&start_from=&ucat=$2
RewriteRule ^subaction/showfull/id/([0-9]+)/ucat/([0-9]+) /manufacturers/automobile/auto-bearing.php?subaction=showfull&id=$1&archive=&start_from=&ucat=$2

it works great for the atv.php however when i go to auto-bearing.php and click one of the links there it goes to the re-written url but atv.php main page opens with th e listings. I guess it doesn't see the second line.

Any ideas would really be appreciated.

Sincerely,

jdMorgan

12:58 am on Sep 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



blue_eagle,

That's because the patterns in your two rules are identical. So any request that would match the second rule will also match the first. Therefore, the second rule will never be applied.

I suspect you misunderstood how mod_rewrite works: Any requested URL that matches the pattern on the left side of the rule will be rewritten to the URL-path on the right side.

This recent [webmasterworld.com] thread has an explanation of mod-rewrite's action, and may be helpful to you.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

blue_eagle

3:58 am on Sep 24, 2005 (gmt 0)

10+ Year Member



So what should I do to have a list of lines that will apply to each page. I also wonder how can I re-write all the php?subaction=etc. files without giving atv.php or auto-bearing.php.

I spent whole day trying to do this and reading a lot.

Thanks a lot..

blue_eagle

5:21 am on Sep 24, 2005 (gmt 0)

10+ Year Member



Thanks a lot, I guess I solved it after whole day dealing with this. I mod re-wrote my brain :)