« Get The Most Out of Your PC | Home | Law and Order »
Redirect non WWW traffic to your blog!
The Problem
Search engines consider web addresses with the ‘www.’ prefix to be different from the same address without the prefix. For example ‘http://www.theangrywalrus.com’ will be seen as different compared to ‘http://theangrywalrus.com’. This becomes a problem because a lack of consistency throughout your site can be harmful to your page rank – and no aspiring blogger needs that sort of thing on his/her mind.
Luckily for us, there is a simple fix for this. We will add 3 lines of code to the .htaccess file located on our server. This will redirect all the traffic from our non-WWW address to our WWW address. When I made this change I didn’t have anything written in my .htaccess file, but if you do, it goes without saying that a backup should certainly be made before any changes are made and the file re-uploaded. Be smart people!
The Fix
Here are the simple steps that you need to go through to make this simple change:
- Retrieve your .htaccess file from your server
- Create a backup of the above file
- Add the code below, and then re-upload
Here is the code that I used to achieve this redirect. I have substituted my blogs address so you can see just exactly how this works. This code also uses a wild card * that will grab whatever comes after the ‘.com/’ and apply it to the redirect if necessary. The code contained in this article only works if your server is using Apache.
RewriteEngine On RewriteCond %{HTTP_HOST} ^theangrywalrus.com [NC] RewriteRule ^(.*)$ http://www.theangrywalrus.com/$1 [L,R=301]
That’s all there is to it; happy blogging everyone.
Similar Posts:
- None Found
Comments are closed
Comments are currently closed on this entry.