How to do apache redirect from 'any' incoming domain to the main domain
Some 3rd party web site domain www.example.com
was pointed to an IP address of our web site - www.oursite.com
. So basically, 开发者_如何学运维accessing example.com
opens up oursite.com
(but with example.com
visible in the browser)
I was playing around with Apache redirection but I can't manage to make it work. First I tried redirection for given example.com
address. Then I looked for a way to redirect from any incoming domain. No luck in both scenarios. Can anyone help?
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^/*(.*)$ http://www.example.com/$1 [R=301,NC]
Will redirect all requests that are not for "www.example.com", to "www.example.com".
精彩评论