I have a .htaccess redirect for "non www":
RewriteEngine on RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
it works. But I also have some subdomains besides www. If I call, for example, http://shop.example.com , it redirects me to: http://www.shop.example.com
I do not want to write subdomains to the .htaccess file, it should work automatically, just ignore anything else besides www, and: 'as follows:
if subdomain =='' -> redirect to www.HTTP_HOST.... elseif subdomain !='' && subdomain !='www' -> do nothing.
thanks!
redirect apache .htaccess mod-rewrite
Milmike
source share