Removing www from Multi-sites or Subdomains in .htaccess

If you are running a Multisites or Subdomains sites this .htaccess RewriteRule code might come in handy specially for purpose of SEO. You can clean up your URL from http://www.yourdomain.com to http://yourdomain.com and remove the “www” with 301 redirect to non-www.

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

If you want to add the www to URLs check this code out.