我需要从重写我的网址:
HTTP://***.com/index.php猫= VAR和放大器;页面= 1
到
HTTP://***.com/VAR/1
使用301重定向。
我得到这个至今:
的RewriteCond%{THE_REQUEST} ^(GET | POST)的index.php ?
的RewriteCond%{QUERY_STRING} ^猫= &AMP(*);页=(*)。
重写规则。 / 1%/ 2%[R = 301]
RewriteEngine叙述上
的RewriteCond%{REQUEST_URI} ^ /!(文件|管理员)/
重写规则^(。*)/(。*)$ /index.php?cat=$1&page=$2 [L]
但第3的规则似乎并不在所有的工作。 (我在htaccess的初学者)
我该如何解决这个问题?谢谢!
编辑: 由于杰茜,解决方法:
的RewriteCond%{THE_REQUEST} ^(GET | POST)的index.php ?
的RewriteCond%{QUERY_STRING} ^猫= &AMP(*);页=(*)。
重写规则^(。*)/(。*)$ /index.php?cat=$1&page=$2 [L,QSA]
RewriteEngine叙述上
的RewriteCond%{REQUEST_URI} ^ /!(文件|管理员)/
重写规则^(。*)/(。*)$ /index.php?cat=$1&page=$2 [L]
解决方案
将其更改为重写规则^()/(的)$ /index.php?cat=$1&page=$2 [L,QSA]和尝试
I need to rewrite my url from:
http://***.com/index.php?cat=VAR&page=1
to:
http://***.com/VAR/1
With 301 redirection.
I got this so far:
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]
But the first 3 rules doesn't seems to work at all. (I'm a beginner in htaccess)
How can i fix this problem? Thanks!
EDIT : Thanks to Jassie, the solution:
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]
解决方案
change it to RewriteRule ^(.)/(.)$ /index.php?cat=$1&page=$2 [L,QSA] and try