0

I have a web app running on http://domain.com and I just bought another domain http://domain2.com. Both domains are pointing to the same DNS servers and they are both pointing to the same IP address.

What is the best way or how should I setup my Apache config to get http://domain2.com/blah to point to http://domain.com ?

So that...

would be the same thing as

2

Use an alias ! (Note that mod_alias has to be enabled)

<VirtualHost * >
    ServerName www.domain1.com
    DocumentRoot /var/www/domain1
</VirtualHost>

<VirtualHost * >
    ServerName www.domain2.com
    DocumentRoot /var/www/domain2
    Alias /blah /var/www/domain1
</VirtualHost>
-3

Create two virtual host entries and point each virtual host's document root to the same path.

Example:

<VirtualHost * >
ServerName www.domain1.net
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost * >
ServerName www.domain2.net
DocumentRoot /www/domain
</VirtualHost>
  • but what about the sub-folder. domain2.com/blah ? – delux247 Feb 12 '10 at 16:35
  • not sure why I was down voted 3x when my answer (A) closely matches the accepted answer and (B) the original post was not very clear and my response gives the intended result as the accepted one. In other words, the original post makes no mention of keeping some content separate. So whom ever down voted this, please be careful in the future! – Kilo Feb 13 '10 at 14:29

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.