This is the first time I use mod_rewrite and I can't get it to work. I have a website with bands and their IDs. What I want:
a URL /bands/My_Band_id13/
should redirect to /bands/index.php?bandname=My_Band&bandID=13
What I have:
RewriteRule ^/bands/(.*)_id(.*)/$ /bands/index.php?bandname=$1开发者_JS百科&bandID=$2
What am I doing wrong?
try adding the 'qsappend|QSA' (query string append)
rewrite flag to your rule, ie.
RewriteRule ^/bands/(.*)_id(.*)/$ /bands/index.php?bandname=$1&bandID=$2 [QSA]
UPDATE: also, try removing / outcommenting your RewriteBase /
. if this doesn't work, neither, try moving your .htaccess
file into the same directory your index.php is in and adapt the RewriteRule
, eg.
RewriteRule ^(.*)_id(.*)/$ index.php?bandname=$1&bandID=$2 [QSA]
精彩评论