Redirect www to non-www

By | 2010/07/25

How can I redirect my website to go from http://www.example.com to just plain ol’ http://example.com?

Use the following rewrite blurb where appropriate for your website. An easy thing to do is to add this to your .htaccess file in your website’s root directory:

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

Done!

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.