My client asked me that a website that is hosted in one server (and pointing there through a domain) should also be accessed (into a specific directory) from another domain, which is not pointing there. For example:

http://www.foo.com, hosted at GoDaddy, with the full website

http://www.bar.com, hosted at Bluehost, needs to access http://www.foo.com/bar, as if it was the http://www.bar.com's root.

So, if anybody enters through http://www.bar.com, it should internally load http://www.foo.com/bar, without visually changing the url.

I amb not sure if this is possible using .htaccess or anything like this. Could anybody show me some light? Thanks in advance


Something like this?

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !bar.com$ [NC]
RewriteRule ^(.*)$ http://www.foo.com/bar/$1 [L,R=301]

I found this in an article by searching for "rewrite all calls to other domain htacces".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.