开发者

redirecting several domains to one in .htaccess

I would like to add some code to my .htaccess to redirect several different domains to a single domain. I have seen code that will do this for one domain such as:

RewriteCond %{HTTP_HOST} ^www\.example\.net  
RewriteRule (.*) http://www.example.com/$1 [R=permanent,QSA,L]

But what is the best approach to have multiple domains redirected to a开发者_如何学编程 single domain?


Only redirect if the domain is not the one you want to redirect to:

RewriteCond %{HTTP_HOST} !(^www\.example\.com$)  
RewriteRule (.*) http://www.example.com/$1 [R=permanent,QSA,L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜