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

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

| 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.