Monday, July 6, 2009

How to redirect the www version of your site to non-www

Let's suppose you have a website. Did you know you probably have 2 versions of the same site? Try it, remove or add www and see what you get. If you want to consolidate your URLs, as the folks at http://no-www.org/ would advise, and you have a linux server follow these steps.

1. Login to your server so that you can create a file called .htaccess in the root directory.
2. Add this code to your .htaccess file.

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

3. Replace lesliesteward.com with your website name.
4. Save

Now all your www.foo.com will point to foo.com. Good luck. If you have trouble, just leave a comment.


0 Comments:

Post a Comment

<< Home