Mose Mose - 1 month ago 21
Apache Configuration Question

Redirect a domain invisibly

I have a customer who wants his domain to be redirected to some other site. For example:

www.hisdomaine.com => www.him.somewysiwyghost.com

the redirection should be transparent so www.hisdomain.com/somefolder should translate to www.him.somesysiwyghost.com/somefolder

important to him is, www.him.somewysiwyghost.com should never be visible to the user. the user should see www.hisdomain.com. because of this frames aren't an option. also frames are not the best options for SEO.

I tried using mod_rewrite for this, using this rule:

RewriteRule (.*) http://www.him.somewysiwyghost.com/$1 [L]


It works fine, except the URI translates to www.him.somewysiwyghost.com so the user could see it. How could I translate invisibly?

3on 3on
Answer

You should use mod_proxy as such in a vhost:

<VirtualHost *:80>
    ServerName hisdomaine.com
    ServerAlias www.hisdomaine.com
    ProxyPass / http://www.him.somesysiwyghost.com
    ProxyPassReverse / http://www.him.somesysiwyghost.com
    ProxyPreserveHost On
    <Location />
        Order allow,deny
    Allow from all
    </Location>
</VirtualHost>
Comments