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?


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