我需要重写我的网址:
HTTP://***.com/index.php猫= VAR&安培;页= 1
为:
的http://***.com/VAR/1
使用301重定向。
到目前为止我得到了这个:
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index.php\?
RewriteCond %{QUERY_STRING} ^cat=(.*)\&page=(.*)
RewriteRule . /%1/%2 [R=301]
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(files|admin)/
RewriteRule ^(.*)/(.*)$ /index.php?cat=$1&page=$2 [L]
但前3条规则似乎根本不起作用。 (我是htaccess的初学者)
我该如何解决这个问题?谢谢!
编辑: 感谢Jassie,解决方案:
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index.php\?
RewriteCond %{QUERY_STRING} ^cat=(.*)\&page=(.*)
RewriteRule ^(.*)/(.*)$ /index.php?cat=$1&page=$2 [L,QSA]
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(files|admin)/
RewriteRule ^(.*)/(.*)$ /index.php?cat=$1&page=$2 [L]
答案 0 :(得分:1)
将其更改为RewriteRule ^(。)/(。)$ /index.php?cat=$1&page=$2 [L,QSA]并尝试