301 Redirect that makes www non-www

OK, I do 301 redirects all the time for clients, when they move or change their site, but what is an easy way to make the redirect from www to non www?

Simple, put this into the .htaccess file of the site in question.  It works.

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

Thanks to Stackflow for this answer, which according to Google, I keep looking for.

 


Leave a Reply