views:

22

answers:

1

Let I have two domains named www.abc.example and www.xyz.example hosted in different servers.

I have a .htaccess file in the root directory of www.abc.example (i.e. www.abc.example/.htaccess)

What will be the .htaccess script if I want to load the contents of www.xyz.example when I request from www.abc.example.

As for example: If I browse www.abc.example/test then it will display the content of www.xyz.example/test and so on without changing the host url (i.e. www.abc.example) in browser's addressbar.

+2  A: 

What you're trying to do is run a reverse proxy. It requires mod_proxy on the server.

The documentation seems to suggest you'd want something like:

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / http://www.xyz.example/
ProxyPassReverse / http://www.xyz.example/

Assuming that such configuration is allowed in .htaccess. If not, you will have to use mod_rewrite and a RewriteRule with the [P] flag:

RewriteRule ^/(.*) http://www.xyz.example/$1 [P]

If you're going the RewriteRule route, don't forget to add RewriteEngine On if it isn't there already!

Dave