RewriteEngine 文件夹重定向
我正在编写一个重写规则,将所有网址从 mysite.co.uk/en/
重定向到 mysite.co.uk/
。我写了以下内容。只是希望有人确认它对我来说是正确的,并建议可能的改进(如果有)。
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
I am writing a rewrite rule to redirect all urls from mysite.co.uk/en/
to mysite.co.uk/
. I have the following I have written. Just would like someone to confirm it is correct for me and suggest possible improvements if any.
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过大量研究,我应该能够做到这一点:
redirect 301 /en/ http://www.mywebsite.co.uk/
redirect 301 /en/ http:// www.mywebsite.com.au/
redirect 301 /en/ http://www.mywebsite.co.nz/
我们将重定向任何要访问的网址
www.mywebsite.co.uk/en/
或mywebsite.co.uk/en/
至www.mywebsite.co.uk/
After much research turns out I should be able to do just this:
redirect 301 /en/ http://www.mywebsite.co.uk/
redirect 301 /en/ http://www.mywebsite.com.au/
redirect 301 /en/ http://www.mywebsite.co.nz/
This we redirect any urls that are going to
www.mywebsite.co.uk/en/
ormywebsite.co.uk/en/
towww.mywebsite.co.uk/
使用下面的代码
Use below code