[thelist] Mod rewrite: Handling Two Domains

Dave Stevens evolt at davestevens.co.uk
Wed Sep 6 10:09:39 CDT 2006


Hello all,

I've been browsing through the archives re: this problem but was only 
able to find someone who was handling two domains on one host. I have a 
further complication:

I have a domain name, foo.com. I also have bar.com. A fully functional 
site is at bar.com, which has a number of rewrite rules to handle search 
engine friendly URLs and the like.

foo.com is on a different host (different country, different data centre 
- they couldn't be further apart if I tried) to bar.com, however I need 
requests sent to foo.com to be processed by the files at bar.com, 
without users knowing that bar.com is involved.

i.e. www.foo.com/section/page.html
will serve up www.bar.com/section/page.html
but the user will continue to see www.foo.com/section/page.html in their 
browser's address bar.

using an .htaccess file on the root of www.foo.com, I was able to 
achieve this superficially but files below the root were not accessible 
- no error message, they just weren't opened. Here's my .htaccess code:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.foo.com$ [NC]
RewriteRule ^(.*)$ http://www.bar.com/ [P,L]

The 'P' there invoking the Proxy option.

Could anyone shed any light on whether this is achievable and if so, how 
I should go about it?

Many thanks
Dave



More information about the thelist mailing list