修改.htaccess以包含参数
我有以下.htaccess文件修改.htaccess以包含参数,.htaccess,.htaccess,我有以下.htaccess文件 RewriteEngine On RewriteRule ^(signup|login|validatesignup|validatelogin|links|stats)/?$ index.php?page=$1 RewriteRule ^(\w+)/?$ redirect.php?code=$1 现在,基本上,除了上面的列表,它会将任何内容重定向到redirect.php?code=which\u发送的内容,但是列表中的任何内容都会重定向到index.php?
RewriteEngine On
RewriteRule ^(signup|login|validatesignup|validatelogin|links|stats)/?$ index.php?page=$1
RewriteRule ^(\w+)/?$ redirect.php?code=$1
现在,基本上,除了上面的列表,它会将任何内容重定向到redirect.php?code=which\u发送的内容
,但是列表中的任何内容都会重定向到index.php?page=stats
现在,我的一些页面有GET参数,比如index.php?page=stats
现在我基本上希望stats&id=1
也重定向到index.php?page=stats&id=1
但这不起作用
这可以吗?您需要使用
QSA
标志:
RewriteEngine On
RewriteRule ^(signup|login|validatesignup|validatelogin|links|stats)/?$ index.php?page=$1 [L,QSA]
RewriteRule ^(\w+)/?$ redirect.php?code=$1 [L,QSA]
它将使任何现有的查询字符串参数附加到新查询字符串的末尾。@Ali您使用的URL是什么?