Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Possible Duplicate:
Prevent virtual host on same server interact on apache

I have a vps apache 2.0 webserver, with multiple domains and multiple IPs set.

In document root /var/www/html/ I have http://serverA.com, and I create a virtual host in folder /var/www/html/serverB for http://serverB.com.

They work great for both, but the problem is I can access serverB files with the URL http://serverA.com/serverB/, which I don't want to happen. How do I prevent that?

share|improve this question

migrated from stackoverflow.com Jun 5 '12 at 0:36

This question came from our site for professional and enthusiast programmers.

marked as duplicate by toomanyairmiles, John Conde Jun 5 '12 at 13:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

Helo Sooosoo Soo.

The reason this is happening is simply because "SERVERA.COM" is considered the parent folder of "SERVERB.COM". And again this is happening because "/var/www/html/" is the foder where apache knows all its files will be so since you don't have Servera.com in a sub folder in the "WWW" folder, if you type local host it will show you servera.com. It is supposed to be "/var/www/html/serverA/".

If you didn't under stand this here is another way to put it.

/var/www/html/ is the main folder so lets say servera.com's index.html page was in here (Which it is). When you type localhost you want it to show a directory showing a white page with both folders on it.

To fix this issue you have to simply move servera.com's contents to a folder called servera.com.

So basically you just do what you did with serverB.com.

Change the virtual host to go to the new folder.

Now when you type localhost you should see a

share|improve this answer