A Simple Fix to Improve Your Google Rank
This one piece of advice is extremely important for every blogger and every website developer alike. Every website should take care of this one item as soon as they launch the site yet very few actually do. So what is it that every site needs but most don’t have? The answer to that is simple: a redirect that adds www to any address on your site that doesn’t already have it.
I know. I know. That sounds really complicated. Let me bring this whole concept down to a dummy level so that it will be foolproof for anyone to implement on their website. I promise that by the time you are done with this post, you will have no problem implementing this on your website in a matter of about two minutes!
Why is this so important?
Believe it or not, this actually has several very important functions for your website. Google and other similar search engines are constantly scanning your site in an attempt to get fodder for their search results.
We all know this. But did you know that Google’s programming is set to penalize sites that contain duplicate content? That means that if your website has two pages that contain the exact same content, Google will very likely refuse to list either one. This concept holds true for other major search engines as well.
Without using a redirect on your non-www addresses, Google will interpret your entire site as a duplicate. It will see the page ‘http://www.sitesketch101.com’ and ‘http://sitesketch101.com’ as two different pages with the exact same content which will instantly penalize you and reduce the number of visitors that you can get through their search engine. Notice that the only difference between those two addresses is that one of them is preceded by the ‘www’ and the other is not.
So how do we do it?
So with that in mind, let’s create a fix to this issue that only takes about a minute or two to implement. Let’s force every attempt to access our site to automatically add the www to the front of the url. This will cause Google, Yahoo, and others to index our content and allow potential visitors to find our site through their indexes.
In the root directory of your website you should find a file called “.htaccess”. If you don’t already have one then simply create a new text document and name it “.htaccess”. Notice that this filename has an extension but no actual file name preceding the extension. It’s a bit unusual, but that’s the way that the internet is set up.
Once you have located or created this file, open it in either Dreamweaver, Notepad, or whatever else you may use as your preferred code editor. Once you have the file open there are only two things that you have to do. First, locate the following code and if it doesn’t already exist (such as if you had to create the file from scratch) then add this code on the very first line:
RewriteEngine On
Second and finally, insert the following code immediate after the code above. Be sure to replace “sitesketch101.com” with the domain name or your site. When you are finished simply re-save the file to the root directory of your website.
RewriteCond %{HTTP_HOST} ^sitesketch101.com [NC]
RewriteRule ^(.*)$ http://www.sitesketch101.com/$1 [L,R=301]
When you are finished the completed code should look like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sitesketch101.com [NC]
RewriteRule ^(.*)$ http://www.sitesketch101.com/$1 [L,R=301]
That is all it takes. Now go to your browser and type in the domain of your site without the www in front of it. It should automatically redirect you to the url with the www. Most users will never even notice this…but Google will…and Yahoo…and…well you get the point!

sbcjr said:
Excellent info- thanks!!
Nicholas Z. Cardot said:
sbcjr » Glad I could help. Just let me know if you have questions about anything!
techandlife said:
The theme for my site had the following in the .htaccess file:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Does this do the same thing? If not, how should I edit it? Thanks.
Nicholas Z. Cardot said:
No…it won’t do the same thing. Just below the line that says “RewriteEngine On” press enter a few times and insert the following code on the two lines following that line of code.
RewriteCond %{HTTP_HOST} ^sitesketch101.com [NC]
RewriteRule ^(.*)$ http://www.sitesketch101.com/$1 [L,R=301]
Ferry said:
So its look like this
# BEGIN WordPress
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sitesketch101.com [NC]
RewriteRule ^(.*)$ http://www.sitesketch101.com/$1 [L,R=301]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Am i right?
Nicholas Z. Cardot said:
Ferry –> Yes. That looks right, but make sure that you replace sitesketch101.com with your own websites address.
KonstantinMiller said:
How soon will you update your blog? I’m interested in reading some more information on this issue.
Nicholas Z. Cardot said:
KonstantinMiller » I update my blog almost every day. If you have questions about anything in particular, just let me know and I’ll be sure to include tutorials, how-to’s or whatever else might help you out!
Ben said:
Is it possible to perform the 301 redirect with Blogger? I haven’t been able to find the answer anywhere, but if you knew it that would be very helpful.
Nicholas Z. Cardot said:
Ben » Good question. I don’t have the answer but I am going to see if I can come up with an answer for you. What is the address of you blog? I’d love to be able to check it out.
Nicholas Z. Cardot said:
Ben » I just thought of something. Are you trying to redirect the entire blog to a different domain or are you trying to redirect specific posts to point to something else. If you are redirecting the entire blog, I can come up with a pretty easy answer for you. Just let me know what you need and I’ll try to help you out here.
Vicky said:
Hi, I want to redirect my all pages to http://jewelnwatches.com instead of “http://www.jewelnwatches.com” version what changess i have to do in your example plus in future i will have some sub-domains like http://blog.jewelnwatches.com also so, does this method effect them, If it does what can we do?
Thanks
And by the way i really like your blog articals and design.
Nicholas Z. Cardot said:
Vicky » Great question and I have an easy solution for you. In our lines of code that I showed you above they looked like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sitesketch101.com [NC]
RewriteRule ^(.*)$ http://www.sitesketch101.com/$1 [L,R=301]
The conditional line is that the domain did not have the www and the rule was to add the www. To change it simply change the condition to have the www and the rule to not have it. It will now look like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.sitesketch101.com [NC]
RewriteRule ^(.*)$ http://sitesketch101.com/$1 [L,R=301]
Of course you need to make sure that you replace sitesketch101.com with the domain name of your site.
Does this answer your question? If not, just let me know and I’ll be glad to help you out!
Sathish said:
That is useful thanks for the tip. Will use it right away!
Nicholas Z. Cardot said:
Sathish » Great. I hope it helps. Where’s your blog or website? I’d love to check it out.
Web Site Design Kent said:
Ahead of the game here….already implemented on my site and not long after I remembered to do it, I noticed I gained a few positions in the search results too. Great tip tho, easy to do and free seo value.
ZXT said:
I checked my blog and type it without the www and when it automatically put the www afterwards on the address bar. Thismeans I don’t need to do anything right? Might be the default from my host.
Nicholas Z. Cardot said:
ZXT –> That’s correct. I think that WordPress might have it built in to it.
Mukund said:
Oh!! I never knew this Nicholas! So, what do we do in order to treat both the links as a single webpage in blogger? Do you know why it treats it as two separate pages?
Nicholas Z. Cardot said:
Mukund –> You can’t change the way that blogspot forwards them.
ZXT said:
-> Mukund – It’s the way search engines works. And if you are using blogspot then you can not do anything about it because
http://www.myblog.blogspot.com and myblog.blogspot.com will be treated as different pages.
Now if you have WordPress.com blog then it will automatically remove the www if you try to include it on your url
eg typing:
http://www.myblog.wordpress.com will automatically become myblog.wordpress.com
Joe said:
After making this change, Firefox give me an error that the page is being redirected in a manner that can never be resolved so I removed the change. Any idea why this happened? I wasn’t sure if it was the browser or something else.
Arisu said:
I just found out that my site doesn´t do this… mmm, so thanks for the advice Nick
I´m gonna fix it now… and hopefully I´ll launch it this Monday, at last…
Ruchi said:
Absolutely great, i was not having that thing set for my blog, i will give it a try and let see how it helps.
Boni said:
I think this can be set in the wordpress admin page. I think it is easier.. but it all up to you. This post give me more knowledge. All your posting really helpful, thank you. =)
kevin said:
If running the site on wordpress, Does it make more sense to do this with a wordpress pluggin or directly on the .htaccess file?
I’m guessing it might make more sense at the .htaccess level since it’s one of the first files read…and if the pluggin ever fails or becomes unsupported for any reason…you are safe.
Any opinions on this? WP pluggin OR .htaccess
Thx!
Shamim said:
I knew that having www and without www means two separate sites but i didn’t know how to apply a 301 redirect on them.
This is a post which will easily make me to do that. Thanks nich.
I have a website which was hosted on blogger. But later I have decided switched to wordpress. So the permalink was changed. But in google’s index there were lots of pages remained.
Ultimetly my site seemed to be penalised. It haven’t yet got fixed.
Will you help me on that issue??
Thanks,
Shamim
Shamim said:
Eventually I have done this. But whenever i enter my website in the browser as example.com than it shows only http://example.com rather than http://www.example.com.
Is there any wrong?
Nicholas Cardot said:
Shamim » I’m not sure. Sometimes it takes a few minutes to update once you make the changes.
kevin said:
Hi Nicholas,
I’ve been doing some SEO reading lately and this phrase seems to contradict what Google is saying. Do you have any opinion on this?
“We all know this. But did you know that Google’s programming is set to penalize sites that contain duplicate content? That means that if your website has two pages that contain the exact same content, Google will very likely refuse to list either one. This concept holds true for other major search engines as well.”
This google video says that the penalty is only for spam NOT for legitimate sites that may have legitimate reasons for having duplicate content (forum pages for example). Google will STILL list the site. That said, duplicate content dilutes page-rank, but there is no Google penalty per se. This is a REALLY good video btw.
Nicholas Cardot said:
kevin » Actually you’re right. Google itself is much more advanced now than they once were. However, there are several things to keep in mind on this subject. First, other search engines might not be. Second, duplicate content can dilute the page rank and the links contained in it.
Don Gilbert @ SEO said:
Very, very true.
Will and I started telling people about this a couple years ago, but those we talked to were thinking we were trying to sell them snake oil.
But it really is true. I have actually seen many sites that have a different PR for http://example.com than http://www.example.com.
Thanks for this great post.
My Latest Blog Post: Crazy for Comments Valentine’s Day Giveaway!
Kok Siong Chen said:
Thanks for sharing! You have given a simple but useful tip for me to fix the code problem. I have implemented it just now!:)
My Latest Blog Post: Cri du Chat Syndrome – Human with Cat-like Cry
Spyros said:
There is actually a wordpress plugin that does that for you and it is called “Enforce www. Preference”
My Latest Blog Post: What is Function Overloading && How to Use it to Write Better Code
Nicholas Cardot said:
Spyros » Very cool. I was not aware of that plugin and I’m glad that you told me about it. Thanks!
Vinish Parikh said:
Great tip will surely apply this to my site
My Latest Blog Post: Differences between Bill of exchange and Promissory note
Prakash said:
If i am having my blog as a secondary installation in root directory i.e with a new child directory, then how the code will vary. Please Mention
John said:
Groan. I’m a newb at this but interested in making my fledgling blog better. I’m running the Elegant Themes ePhoto them, and it does not have a “.htaccess” file. So I created one and uploaded it via FTP. Now I get the following error message. I’m sure I screwed something up. And since this is a system file, I can’t see it on my root directory using my FTP application. What to do? Many thanks.
The page isn’t redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
* This problem can sometimes be caused by disabling or refusing to accept
cookies.
John said:
Never mind, figured it out myself. Will use the “Enforce Preference” plugin to automate the process.
jm