Do you remember in school, when you had an user account on the school’s server and each student could host a website out of his home’s www folder ?
Well, the school admin was using Apache’s mod_userdir to map urls such as school.com/student/index.html to /school/server/student/www.
I decided I wanted to do something similar on my dev setup except that, instead of having several users, I have several projets.
So, let’s say I have my computer setup to know that *.sam.net is my local machine and I have several project in /Users/sam/webdev
- dev1.sam.net >> /Users/sam/webdev/dev1
- dev2.sam.net >> /Users/sam/webdev/dev3
- dev3.sam.net >> /Users/sam/specialdev3
I can now create two Virtual Hosts instead of three.
In the first one, I will setup the dev3 mapping as it is an exception.
In the second one (should be loaded last by Apache) I’ll add :
Test your config and restart Apache
sudo apachectl restart