Forum Moderators: phranque
I was wondering if it was possible to create subdomains "on the fly" using apache Rewrite Rules if the subdomains are outsite of the main site's DocumentRoot.
So, for example, I have a site (user.com) located at:
/home/user/htdocs
/home/user/subdomains
I've tried this, a slightly modified version of the code posted in the post above:
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^(www\.)?user\.com$ [NC]
RewriteCond %{HTTP_HOST}<->%{REQUEST_URI} ^(www\.)?([^.]+).*<->/([^/]+) [NC]
RewriteCond %2<->%3 !^(.*)<->\1$ [NC]
RewriteRule ^(.+) /home/user/subdomains/$1 [L]
Is there any other way to do this?
Thanks,
Jon
[edited by: jdMorgan at 8:14 pm (utc) on July 30, 2005]
[edit reason] Corrected formatting [/edit]
Welcome to WebmasterWorld!
Assuming that you're using .htaccess, there's no way to go "above" the current document root. To allow this would open sites up to all kinds of security exploits.
So, your choices are to get access to httdp.conf and create your virtual hosts there, or to create the subdomain-subdirectories at or below the current document root.
Jim