Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I edit /etc/hosts file to add domains. I add new virtual host for new domain. So I can easily develop.

What I want now is to have apache conf to

  1. if there is a virtualhost domain definition follow
  2. if not, look for /var/www directory, if there is dir follow
  3. if there is not, redirect to /var/www/nerkn

Can apache conf make it?

1)Example domain example.com

  1. there is no example.com in virtualhost
  2. there is a directory named /var/www/example.com so server there

2)Exampple domain ex2.com

  1. there is no ex2.com in virtualhost
  2. there is no directory named /var/www/ex2.com
  3. serve from /var/www/nerkn
share|improve this question

1 Answer 1

up vote 0 down vote accepted

Mod_vhost_alias, where nerkn defined as default virthost

VirtualDocumentRoot d:/Sites/%0/web
VirtualScriptAlias d:/Sites/%0/cgi-bin

define base location of bare minimum (my config)

while adding <VirtualHost dcweb.e-city.net.ru:80> allow redegine-add vhost-specific details

share|improve this answer
it only solves 2nd bu its ok. Thank you –  nerkn Oct 18 '11 at 13:33
it work most times for me in 1st mode - I just copy skeleton to the new site-location and have site ready without restart of apache –  Lazy Badger Oct 18 '11 at 13:46
wonderful ln -s nerkn new-site –  nerkn Oct 21 '11 at 7:55

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.