.htaccess倒换秒(查询字符串),带2个变量,并正确重写
我需要从以下位置重写我的url: http://***.com/index.php?cat=VAR&page=1 致: http://***.com/VAR/1 使用301重定向 到目前为止,我已经做到了:.htaccess倒换秒(查询字符串),带2个变量,并正确重写,.htaccess,mod-rewrite,url-rewriting,rewrite,.htaccess,Mod Rewrite,Url Rewriting,Rewrite,我需要从以下位置重写我的url: http://***.com/index.php?cat=VAR&page=1 致: http://***.com/VAR/1 使用301重定向 到目前为止,我已经做到了: RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index.php\? RewriteCond %{QUERY_STRING} ^cat=(.*)\&page=(.*) RewriteRule . /%1/%2 [R=301] RewriteEng
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]
将其更改为RewriteRule^(.)/(.)$/index.php?cat=$1&page=$2[L,QSA]并尝试将其更改为RewriteRule^(.)/(.)$/index.php?cat=$1&page=$2[L,QSA],然后尝试我的快乐的朋友。祝你一切顺利,我的朋友。祝你一切顺利