gw75,
From too many perspectives, your mod_rewrite code is bad:
Code:
RewriteRule ^/reviews$ toy\.php$ [QSA,L]
Some hosts are configured to REQUIRE that you turn mod_rewrite on before writing mod_rewrite statements.
Apache must have the mod_rewrite module enabled. Check the simple test in my signature's tutorial article if your code doesn't work - after getting it correct.
Apache 1.x requires the / after ^ (at the DocumentRoot level) while Apache 2.x believes that it's already there and will NOT match if the / is in the regex (as you have it). If you're not sure which version of Apache you're using, ^/? will work for both.
reviews$ must be at the end of the test {REQUEST_URI} string.
The redirection should cause a 404 as you indicate that toy.php is located in the catalog directory.
QSA, the Query String Appended flag, is superfluous in this case as you're not created a new query string so any pre-existing query string will AUTOMATICALLY be passed along.
Horray! The Last flag is properly terminating your mod_rewrite statement (too many people don't know to use that!).
Hint: Use the R=301 flag during testing so you can see the effect of your redirection and remove it for "production" to retain the reviews link.
Code:
RewriteEngine on
RewriteRule ^/?reviews$ catalog/toy.php [R=301,L]
If you have questions, please review the tutorial (with coding examples) as it's helped many members already.
Regards,
DK
Bookmarks