Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to setup apache2 to host multiple sites, but using the same root-URL and differing in subfolder only, i.e.



It should be easy but I have, after several hours of googling, still not found the right way how to do this. I can find site1 by surfing to but not the other one at all.

I'm using kubuntu server 10.04 and have made conf files in /etc/apache2/sites-available/ and run a2ensite for each site

Is it a .htaccess related problem or do I have to fiddle around with the apache2 conf-files?

share|improve this question
up vote 0 down vote accepted

The "problem" is that you use VirtualHosts for something it wasn't really designed for. A "site" is defined by a own Domain OR IP. So if you make a VirtualHost config for a subfolder (like you) there is a conflict (dunno what your decision factor is? I mean ServerName/ServerAlias). I don't know what exactly happens, but the things you configured in the VirtualHosts will not work as they should (at least not all of them). So what's the solution(s):

  • You could use subdomains like and (if you want to work with VirtualHosts)
  • You could use 1 VirtualHost (for and Directory for your subsites ( and BUT you don't have the same options here as in a VirtualHost config.
  • Probably there are other solutions, but my ones should solve the problem ;)

Hope this helps.


kubuntu server 10.04

You shouldn't use a X-Server on a production system, better for security and performance.

share|improve this answer
Thanks for your explanation, now I have a somewhat better understanding of how this is supposed to work! I'll go for your second solution since I'm on an intranet! – Jonas Malm Dec 1 '10 at 13:00

After som trial and error I have succeeded in what I wanted to do, by changing the line

DocumentRoot /var/www/site1


DocumentRoot /var/www

in both site-conf files (in /etc/apache2/sites-available)

But I have to admit that I have no idea if this will have other effects to my overall setup/security/performance.

Any clues?!

share|improve this answer

Your Answer


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.