major.io words of wisdom from a systems engineer

Strip off www from URLs with mod_rewrite

If you need to remove subdomains from the URL that users enter to visit your website, toss this into your VirtualHost directive:

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

Of course, you can tack on a subdomain too, if that’s what you need:

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