formats

Redirect www to non-www

Published on July 25, 2010, by + in sysadmin.






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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

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

Home sysadmin Redirect www to non-www