Do requests for http://www.subdomain.yourdomain.tld
ever arrive at your server in the first place?
I can see two problems with what you want to do. DNS and Apache Host Configuration. If I call up http://www.subdomain.host.tld
then DNS is going to go away and look for an IP address for www.subdomain.host.tld
, my browser will go to that IP where Apache will steer me into subdomain - which needs to be defined specifically(or caught with a wildcard alias), or I'll end up at the default website for that server. It will be the .htaccess file in the landing directory that I will trigger, so where I land is important.
Basically you cannot call up www.subdomain.host.tld
and arrive at www.host.tld
instead, unless you have dns records for the subdomain, or have a wildcard DNS record for any unknown entries. (see: http://en.wikipedia.org/wiki/Wildcard_DNS_record
). Even with this in place, you would then need Apache to react to these specific subdomains with an alias declaration.
Forget about the syntax of .htaccess for the moment and think about basic traffic flow. If you can get traffic for http://www.anysubdomain.yourdomain.tld
to arrive at your server, and are able to add a wildcard subdomain alias to your httpd.conf/vhost, you have a fighting chance of doing what you want.
This may help you: http://muffinresearch.co.uk/archives...ies-in-apache/