.htaccess rewrite not working
I need help with a rewrite in .htaccess.
I am开发者_运维百科 trying to do the following:
When a user types http://www.example.com/csc/alabama/
I need to pull info from http://www.example.com/csc/index.php?state=alabama
I thought it should be this
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^csc/([^/]*)$ /csc/index.php?state=$1 [L]
I keep getting a 404 error.
On a side note, I would like to be able to do this with a generic sub-directory, so that csc could be abc or anything else but this is not the priority.
You forgot the trailing slash in your pattern. You should also exclude the destination you are redirecting to:
RewriteCond $1 !=index.php
RewriteRule ^csc/([^/]*)/$ /csc/index.php?state=$1 [L]
精彩评论