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]
精彩评论