Sunday, February 14, 2016

apache 2.2 - Two Server Names mapped to the same DocumentRoot



I have a server with two virtual hosts pointing to the same DocumentRoot folder. In that folder there is a Magento installation that manages properly both domains.



Just in case this is important, the DocumentRoot is for both domains:




var/www/magento/htdocs/



Now I need to install a Wordpress site in a folder, but it should be visible only under one domain. That is:



www.domain1.com/blog must show the wordpress blog



www.domain2.com/blog should not show anything



I'm a newby in apache configuration, so I was wondering if someone can point me the right direction to know where to put the files in the server and how to avoid the blog being visible under the second domain.




Thanks!


Answer



You should put Wordpress' files anywhere outside of the DocumentRoot. Then add something like the following configuration to the config of the virtualhost you want Wordpress on.



Alias /blogs /path/to/wordpress


# Put wordpress config here.




The important directive here is Alias to point from a URL to Wordpress' path.


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...