Jump to content

Removing "www" from address bar, for any domain


adrianTNT

Recommended Posts

Hello, I want to remove the "www" from address bar and this code works:

 

RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

 

But... same .htaccess file will be used for multiple domains, how would the above code look if I want it work for any typed domain, not an exact given sample like above?

 

Something like:

RewriteCond %{HTTP_HOST} ^www\.($any_domain)\.com$ [NC]

RewriteRule ^(.*)$ http://($any_domain).com/$1 [R=301,L]

 

Thanks in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.