我正在编写一个重写规则,将所有url从mysite.co.uk/en/
重定向到mysite.co.uk/
。我有以下我写的。只是希望有人确认它对我来说是正确的,并建议可能的改进(如果有的话)。RewriteEngine文件夹重定向
Options +FollowSymlinks
RewriteEngine on
RewriteOptions MaxRedirects=10
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.co\.uk$
RewriteRule ^en/(.*)$ http://www\.mysite\.co\.uk/$1 [NC,R=301]
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com\.au$
RewriteRule ^en/(.*)$ http://www\.mysite\.com\.au/$1 [NC,R=301]
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.co\.nz$
RewriteRule ^en/(.*)$ http://www\.mysite\.com\.nz/$1 [NC,R=301]
RewriteEngine off
我注意到任何网址,你改变了^恩/(.*)$到^(。*)$,这并不占的事实,我在负载平衡器上设置此规则,并且/ en /文件夹不是由cms创建的逻辑文件夹。 – Anicho 2011-12-28 10:35:30