Skip to content
Oct 22 / kkrizka

How To Setup No WWW Redirection

The NO-WWW redirection allows you to redirect any visitors that stumble on yourwebsite.com to www.yourwebsite.com, or vice versa. This is very important for any website, because it improves the search ranking of all your pages . Since your ranking is determined by the number of inbound links to your site, it is important that for high ranking your pages have as much inbound links as possible. However by default, only half the links are counted in the search rank calculation because as far as the computerized crawlers knows, you are running two different websites at yourdomain.com and www.yourdomain.com. Luckily the NO-WWW redirection fixes this problem, and it takes only a few seconds to setup.

The simple NO-WWW redirection requires that your web host has the Apache mod_rewrite module enabled. This module is very common, so it is quite probable that everything you need is there. All you have to do now is create a new file named .htaccess in the folder that holds the top of your web page files (usually called www or public_html), and add the following code at the end of it:

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

Of course don’t forget to change krizka.net to your domain, because otherwise I might be getting quite a lot of traffic. 😉 From now on when a visitor or a spider gets to your web page via yourdomain.com, he will be automatically redirected to www.yourdomain.com. You only need to add this to top folder of your webpage, because the rules in the .htaccess file are recursively applied to all folders.

Leave a comment