Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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>
share|improve this answer

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>
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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