First off, if you don't have access to the DNS server to create a wildcard DNS setup, redirecting won't matter in the slightest.
Also www. IS a subdomain so if you are not careful you will have a closed loop.
I don't think it would be possible with .htaccess (though it's not my specialty) redirecting ALL subdomains, (including www) to the hostname is practical of course.
Or you could get your hosting techs to add a wildcard ServerAlias and a RedirectMatch to the VirtualHost settings in httpd.conf to create a "catchall virtualhost"
Additions in blue
Code:
<VirtualHost *:80>
ServerName hostname.tld
ServerAlias *.hostname.tld
RedirectMatch 301 (.*) http://www.hostname.tld$1
</VirtualHost>
much cheaper in server CPU resources than mod_rewrite
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
|