Automatic subdomain creation in htaccess on Apache
Posted
by
ANOther8660
on Server Fault
See other posts from Server Fault
or by ANOther8660
Published on 2011-02-14T15:18:17Z
Indexed on
2011/02/14
15:27 UTC
Read the original article
Hit count: 207
I have a domain in my HOSTS file;
www.mytestbusiness.com
However, I want to convert some folders into subdomains automatically, e.g.
www.mytestbusiness.com/birmingham
www.mytestbusiness.com/london
which should be:
www.birmingham.mytestbusiness.com
www.london.mytestbusiness.com
Only for some folders do I want to keep it as a domain/folder link, e.g.
www.mytestbusiness.com/styles/
I don't want the CSS folder becoming a subdomain, or certain folders like cgi-bin, dwoo etc. (dwoo contains the site templates!)
I am running Apache 2.2 on Windows 7 Home Edition, and the site has no issues, it's just creating subdomains in .htaccess without having to manually declare them which is the problem.
What's the best way to do this, other than manually declaring them in httpd-vhosts.conf as I used to do?
Thanks
© Server Fault or respective owner