开发者

How to do apache redirect from 'any' incoming domain to the main domain

开发者 https://www.devze.com 2023-03-09 23:34 出处:网络
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 examp

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".

0

精彩评论

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