Page 1 of 1
Point any and all subdomains to the same location - Apache
Posted: Sat Oct 15, 2005 10:34 am
by phice
I'm looking for a htaccess/conf modification that will forward any and all subdomains to the same location (eg: to the main www location), but keep the same subdomain. Possibly something like *.my.dom => /public_html/ ?
Also, I'd like to be able to forward "my.dom" to "
www.my.dom" if there isn't a subdomain present.
Many thanks in advance.
Posted: Sun Oct 16, 2005 11:29 am
by Skara
Unless I'm mistaken, you have to have a DNS entry for each subdomain. In other words, wildcards won't work. You'd have to use each subdomain redirection.
e.g.
redirect sub1.my.dom to
http://www.my.dom
redirect sub2.my.dom to ...
There's no need for a www in front, though. The www is the biggest piece of garbage I've ever seen. A waste of four character spaces.

Posted: Sun Oct 16, 2005 11:55 am
by phice
That's highly unlikely. You should be able to point any and all subdomains through Apache's httpd.conf.
After rooting around, I was able to modify my windows hosts file to allow a fake domain + subdomain, but it doesnt have a wildcard character that I can find. Furthermore, I found...
Code: Select all
<VirtualHost *.domain.ext:80>
ServerAdmin webmaster@www.domain.ext
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
ServerName www.domain.ext
ErrorLog logs/www.domain.ext-error_log
CustomLog logs/www.domain.ext-access_log common
</VirtualHost>
but it doesn't matter if I comment that out or not, it doesn't effect it. So, it shouldn't exactly be through Apache, but possibly through a DNS manager. I'll check into what my server has.
Posted: Sun Oct 16, 2005 12:09 pm
by phice
Fixed problem.
Posted: Mon Oct 17, 2005 12:35 pm
by Skara
Hm. It must just be my DNS server, then. Unless I specifically note a subdomain in the records, it can't resolve the address.
Posted: Mon Oct 17, 2005 1:18 pm
by timvw
That's probably 'expected' behaviour.
Have you tried: *.example.com. CNAME example.com.