Automatically Redirect All WWW to Non-WWW for Multiple Domains
This guide is for how to automatically remove www from a domain name, or multiple domain names.
If you want to add WWW, read this guide titled Automatically redirect non-www requests to www for all URLs and All Domains.
The below code will enable you to remove WWW for one domain, multiple domains, or all domains. It is generic enough that you just install it in your domains root folder for a singular domain, or the parent folder above multiple domain names if you want it to apply to all domains hosted in child folders (for shared hosting scenarios).
Insert the below code into a text file. Save the file as htaccess.txt, and upload it to your domains folder. Once there, rename it to “.htaccess” without quotes. If you need help on this, read the applicable instructions in my other post Automatically redirect non-www requests to www for all URLs and All Domains.
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.
