On Apr 24, 2008, at 3:00 PM, Wade Preston Shearer wrote:

I am trying to set up wildcard DNS and web roots for developer sandboxes, like this:

*2.*1.dev.example.com ➞ /home/*1/sites/*2/htdocs/
*2.*1.dev.example.com ➞ /home/*1/sites/*2/htdocs/
*2.*1.dev.example.com ➞ /home/*1/sites/*2/htdocs/


Where *2 is a project and *1 is a username, like this:

www.jdoe.dev.example.com ➞ /home/jdoe/sites/www/htdocs/
blogs.jdoe.dev.example.com ➞ /home/jdoe/sites/blogs/htdocs/
test2.jdoe.dev.example.com ➞ /home/jdoe/sites/test2/htdocs/


Just need to add a CNAME to the dns record for *.dev.example.com.

RewriteEngine on
RewriteCond %{HTTP_HOST} [^.]+\.[^.]+ \.dev.example\.com:[^.]+$ RewriteRule ^(.+) %{HTTP_HOST} $1 [C] RewriteRule ([^.]+)\.([^.]+)\.example\.com(.*) /home/$2/ sites/$1/htdocs$3

We have used this for years and it works great. Because, any time I want to start a new project I can just create a directory in my home directory and it becomes newdirectory.jdoe.dev.example.com and I don't even have to restart apache.

Fred



_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to