.htaccess无法获取未在外部服务器上设置的变量
我必须按类型设置类别,如.htaccess无法获取未在外部服务器上设置的变量,.htaccess,.htaccess,我必须按类型设置类别,如getcategorytype1,getcategorytype2和getcategorytype3 我用.htacces RewriteRule ^getcategorytype1/(.*) category.php?getcategory=type1&q=$1 RewriteRule ^getcategorytype2/(.*) category.php?getcategory=type2&q=$1 RewriteRule ^getcategoryty
getcategorytype1
,getcategorytype2
和getcategorytype3
我用.htacces
RewriteRule ^getcategorytype1/(.*) category.php?getcategory=type1&q=$1
RewriteRule ^getcategorytype2/(.*) category.php?getcategory=type2&q=$1
RewriteRule ^getcategorytype3/(.*) category.php?getcategory=type3&q=$1
如果我通过了urlmysite.com/categorytype1/
getgetcategory=type1,就可以正常工作了
但是如果我想传递其他变量,比如mysite.com/categorytype1/?var=123
,那么var
就无法获得
如何获得额外变量?您需要通过
例如:
RewriteRule ^getcategorytype1/(.*) category.php?getcategory=type1&q=$1 [QSA,L]
QSA是您的解决方案顺便说一句,如果您将数字部分与相应的模式匹配,您可以使用一条规则而不是三条。