开发者

mod_rewrite help can't get it to work

开发者 https://www.devze.com 2022-12-30 02:29 出处:网络
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:

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消