I want to edit the .htaccess file to create an unmasked wildcard redirect of all subdomains to the main www subdomain.
i.e. *.domain.com => www.domain.com
e.g. www.example.domain.com => www.domain.com
When the person types in www.example.domain.com in the browser address bar, I want it to redirect unmasked so that the URL actually visibly changes to www.domain.com.
My present .htaccess file (shown below) forces the 'www' for all 'without www' traffic, i.e. http://domain.com
becomes http://www.domain.com
, but can't figure out what RewriteCond etc. commands to use for the above requirement.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*)$ "http\:\/\/www\.domain\.com\/$1" [R=301,L]
Any help would be greatly appreciated! Thanks in advance.