经过一个多小时的搜索,我仍然无法弄清楚如何将链接从http://site/fr/other
重定向到http://site/other
。
我正在使用此代码:
RewriteEngine On
RewriteRule ^/fr/(.*)$ /$1 [L,R=301,QSA]
答案 0 :(得分:8)
只需删除第一个正斜杠:RewriteRule ^fr/(.*)$ /$1 [L,R=301,QSA]
。
在http://htaccess.madewithlove.be/处尝试此操作。
答案 1 :(得分:2)
从网址
中删除“-xyz-”RewriteRule ^(.*)-xyz-(.*).html$ http://%{SERVER_NAME}/$1-$2.html [NC,R=301,L]
从网址“http://yoursite.com/xyz/some-url.html”
中删除“xyz”RewriteRule ^xyz/(.*)\.html$ $1-watches.html [L,R=301]
从网址“http://yoursite.com/some-dir/xyz/some-url.html”
中删除“xyz”RewriteRule ^(.*)/xyz/(.*).html$ http://%{SERVER_NAME}/$1/$2.html [NC,R=301,L]