Help with Apache mod_rewrite rules

Posted by Brian Neal on Pro Webmasters See other posts from Pro Webmasters or by Brian Neal
Published on 2011-02-26T23:21:31Z Indexed on 2011/02/26 23:32 UTC
Read the original article Hit count: 466

Filed under:
|

I want to change some legacy URL's like this:

/modules.php?name=News&file=article&sid=600

to this:

/news/story/600/

This is what I have tried:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^name=News&file=([a-z_]+)&sid=([0-9]+)
RewriteRule ^modules\.php /news/story/%2/ [R=301,L]

However I still get 404's on the old URLs.

I do have some other rewrite rules working, so I am pretty sure mod_rewrite is enabled and functioning.

Any ideas? Thanks.

© Pro Webmasters or respective owner

Related posts about apache

Related posts about mod-rewrite