htaccess的改变的index.php?毫秒=用户/用户 [英] htaccess for changing index.php?ms=user to /user
本文介绍了htaccess的改变的index.php?毫秒=用户/用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要重定向我的网站网址与301 code
I want to redirect my site url's with 301 code
http://www.domain.com/index.php?ms=user&ms_1=name --> http://www.domain.com/user/name
http://www.domain.com/index.php?ms=2652&ms_1=title --> http://www.domain.com/2652/title
http://www.domain.com/index.php?ms=questions --> http://www.domain.com/questions
http://www.domain.com/index.php?ms=aaa&ms_1=bbb&ms_2=ccc --> http://www.domain.com/aaa/bbb/ccc
在 MS的东西
可以有空间和UTF8字符太
the stuffs after ms
can have space and utf8 characters too
我该怎么办呢?
推荐答案
这应该工作
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index\.php\?ms=(.*)&ms_1=(.*)&ms_2=(.*)\ HTTP
RewriteRule ^ /%2/%3/%4\? [R=301,L]
RewriteRule ^(.*)/(.*)/(.*)$ /index.php?ms=$1&ms_1=$2&ms_2=$3 [L]
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index\.php\?ms=(.*)&ms_1=(.*)\ HTTP
RewriteRule ^ /%2/%3\? [R=301,L]
RewriteRule ^(.*)/(.*)$ /index.php?ms=$1&ms_1=$2 [L]
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index\.php\?ms=(.*)\ HTTP
RewriteRule ^ /%2\? [R=301,L]
RewriteRule ^(.*)/$ /index.php?ms=$1 [L]
这将改变 http://www.domain.com/index.php?ms=aaa&ms_1=bbb&ms_2=ccc
到 http://www.domain.com/aaa/bbb/ccc
,但你看到 http://www.domain.com/index的内容。 PHP毫秒= AAA&放大器; ms_1 = BBB&放大器; ms_2 = CCC
等其他两个环节必须
It will change http://www.domain.com/index.php?ms=aaa&ms_1=bbb&ms_2=ccc
into http://www.domain.com/aaa/bbb/ccc
, but all you to see the content of http://www.domain.com/index.php?ms=aaa&ms_1=bbb&ms_2=ccc
etc for the other two links you have.
这篇关于htaccess的改变的index.php?毫秒=用户/用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文