Forum Moderators: phranque
They look like this.
www.site.com/index.php?page=products
I'm using mod_rewrite to turn them into this
www.site.com/products
The problem I'm having is that the rewrite rules I put in .htaccess don't seem to be doing anything. If I link to www.site.com/products I get 404 not found error. My webhost supports the feature. Here is my .htaccess. Any ideas what I'm doing wrong?
Options All -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^/products/([0-9]+) /index2.php?crn=$1
RewriteRule ^/articles/([0-9]+) /index2.php?article=$1
RewriteRule ^/articles /index2.php?page=articleindex
RewriteRule ^/products /index2.php?page=displaycats
RewriteRule ^/service /index2.php?page=service
RewriteRule ^/myaccount /index2.php?page=myaccount
In practical terms, what this means is that the path to the current directory is stripped from the URL-path examined by RewriteRule. So, if you are in the top-level Web-accessible directory, then the path to the current directory, namely "/", is stripped.
Your rules will likely work better and more efficiently if tweaked as follows:
Options +FollowSymLinks
RewriteEngine on
#
RewriteRule ^products/([0-9]+) /index2.php?crn=$1 [L]
RewriteRule ^articles/([0-9]+) /index2.php?article=$1 [L]
RewriteRule ^articles /index2.php?page=articleindex [L]
RewriteRule ^products /index2.php?page=displaycats [L]
RewriteRule ^service /index2.php?page=service [L]
RewriteRule ^myaccount /index2.php?page=myaccount [L]
Jim