need to remove www from 2nd level subdomain generically in Apache (using rewrite) -


I have a problem with many subdomains: eg

sub1.domain.com and newer Domain.com and xsub.domain.com and much more.

How do I remove www with a general rule in front of any one of these?

Example if someone changes it to www..domain.com or ..domain.com

http: //.domain.com

Thank you

You can use the rewrite module to delete www when this subdomain Before this, an address: www.sub1.domain.com will be redirected to sub1.domain.com:

  & lt; Ifmodule mod_rewrite.c & gt; Option + follow-up option + indexed rewriteignin-on-rewritebase / rewirectand% {HTTP_HOST}! Www.domain.com $ [nc] rereemated conduit% {HTTP_HOST} ^ www. (. *) [NC] rewritable ^ (. *) $ Http: //% 1 / $ 1 [R = 301, NC, L] & lt; / IfModule & gt;  

Comments