Sunday, January 10, 2016

How do I setup apache to have two domains pointing to the same web app



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




Answer



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




ServerName www.domain1.com

DocumentRoot /var/www/domain1



ServerName www.domain2.com
DocumentRoot /var/www/domain2
Alias /blah /var/www/domain1


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...