Forum Moderators: phranque
www.mysite.com -> /srv/www/www/
abc.mysite.com -> /srv/www/abc/
absolutlyanythingcangohere.mysite.com -> /srv/www/anditllredirecttothedirectoryhere
All the mod_rewrite examples I've seen do something like this :
www.mysite.com -> /srv/www/htdocs/
abc.mysite.com -> /srv/www/htdocs/abc/
absolutlyanythingcangohere.mysite.com -> /srv/www/htdocs/anditllredirecttothedirectoryhere
having the subdomains pointing to directories inside the main site, however I want the subdomains to point outside the main site as in the first example above.
<VirtualHost *:80>
DocumentRoot /srv/www
ServerName mysite.com
ServerAlias *.mysite.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain\.com
RewriteRule (.*) [mydomain.com...] [R=301,L]
RewriteCond %{http_host} .
RewriteCond %{http_host} ^([^.]+)\.mydomain.com [NC]
RewriteRule ^(.*) [mydomain.com...] [R=301,L,QSA]
</VirtualHost>
I can't test it right now because my system won't point to the DNS server I have running on my local system.
Like :
www.mysite.com -> /home/thisuserownsthissite/www/htdocs/
abc.mysite.com -> /home/thisuserownsthissite/abc/htdocs/
ddd.mysite.com -> /home/someoneelseownsthisone/ddd/htdocs/
absolutlyanythingcangohere.mysite.com -> /home/andthisuserownsthisone/anditllredirecttothedirectoryhere/htdocs/