本文介绍了将所有子域重定向到根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将所有子域重定向回根.
I need all subdomains to redirect back to the root.
例如).test.website.ca -> www.website.cafake1.website.ca -> www.website.cawww.ggg.website.ca/-> www.website.ca等
Ex). test.website.ca -> www.website.ca fake1.website.ca -> www.website.ca www.ggg.website.ca/ -> www.website.ca etc.
这是我试过的代码:
RewriteCond %{HTTP_HOST} ^(.+)\.website\.ca$ [NC] RewriteRule (.*) www.website.ca/$1 [L,R=301,QSA] 推荐答案您可以使用:
RewriteCond %{HTTP_HOST} !^www\.website\.ca$ [NC] RewriteRule ^ www.website.ca%{REQUEST_URI} [NE,L,R=301]没有 uri,使用相同的 RewriteCond 和:
Without the uri, use same RewriteCond and:
RewriteRule ^ www.website.ca/ [L,R=301]更多推荐
将所有子域重定向到根
发布评论