How to 301 Redirect Non-www to www URLs

In the eyes of search engines, http://appthemes.com and http://www.appthemes.com are considered different websites. So if other websites link to yours using non-www and www urls, you are effectively diluting your Google page rank and losing the benefit of valuable inbound link juice.

Step 1

How can I tell if other websites are linking to mine without the www? Google has a nifty little feature that will show you which sites and how many are doing this. Enter the following in Google search (replace appthemes.com with your site):

link:appthemes.com

The results will show you roughly how many inbound links and juice you’re losing because they aren’t linking to your www site!

So how can you prevent this from happening? The best way is to channel all non-www links into your www links. This is done with two lines of code that need to be added to your .htaccess file (does not work for IIS Windows web hosted sites).

Step 2

First you’ll want to sftp or ssh into your website. Then go to your WordPress root and find the .htaccess file. Edit the file and be careful not to modify any of the existing contents.

At the top, you’ll want to add the following two lines (change appthemes to your domain name):

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

Save and upload .htaccess back to your server. Now try loading up your website without the www and it should automatically change to www.yoursite.com.

Within a few weeks, you should notice slightly higher rankings in Google (assuming you had non-www links to your site). It will also handle any new links as well.

Like this tutorial? Subscribe and get the latest tutorials delivered straight to your inbox or feed reader.

Your rating: none
Rating: 0 - 0 votes

Popular Add-ons

Balanced Payments

Accept credit cards and setup escrow payments.


(3)
$39

Daddy Like

A fast, lightweight, and elegant "like" system for comments, pages, posts,…


(12)
$19

Fortumo SMS payment gateway

Fortumo sms payment gateway for ClassiPress


(3)
$39