You are here

Use the Three Lines of Code to Boost Your Search Engine Traffic

In the world of Web building, an opportunity to develop/code something quickly is a rare occasion. Mostly, you need to spend hours on research, planning and implementation (unless you code with CSS ;) ).

Here's yet another thing you can do in a couple of minutes to help search engines index your site better, so you could get more traffic within a week or two by 5-15%.

Canonicalization Issues

- "What?"
- "Ca-no-ni-ca-lization/canon-ica-lization/canonic-a-liz-ation issues."

It is when your website can be accessed with www and without www in front of it (such as improvetheweb.com and www.improvetheweb.com) and you, the visitors and the search engines are not redirected to only one version.

To the visitors, this doesn't matter a lot, unless they prefer to identify website addresses with 'www' or without (there are pros and cons of either approach).

The issue is that for the search engines, both versions are two different versions of the website, because the search engines index URLs, not websites as a whole.

Why is it a problem?

As the search engines see two websites, the number of pages with the same content doubles. As your visitors link to either of the versions randomly, both of them will have average amount of links.

Of course, the search engines will show one of the versions, but they will only count links that point to one of the versions, to which a specific page belongs to.

For example, if the page is http://improvetheweb.com/overdeliver, the search engines will count links that point to this page - most likely from the http://improvetheweb.com domain and sites that linked to that URL.

For the search engines to take into account all the links that point to your website (such as http://www.improvetheweb.com and http://improvetheweb.com), you need to redirect visitors and the search engines from one version to another.

Thus, the search engines won't be taking into account all your naturally acquired links and won't be showing your pages high in the SERPs as they rightfully deserve.

Why redirect?

By redirect the search engines to only one version of the site, we confirm their suspicion that we only have only one version of the website (not two different sites with similar content).

This way, they treat links to both www and non-www versions as links to one website and thus, which ever version you redirect to, gets a boost of incoming link value from the redirected version.

That's why you'll get more visitors from the search engines, which will lead to more customers, links and profit within a week or two (Google, others may be slower) by 10-15% (the speed relates to how fast the search engines react to the redirect and whether the version you redirect to is fully indexed).

If the version you are redirecting to is not indexed for one reason or another (except outright ban), you'll need to wait while Google and other SEs index the site and start taking all links into account.

This may take a week more or longer, depending on how large your site is. In this case, and if the version you are redirecting from is stronger (has more links), you may notice a slight drop of traffic, which will later return to normal and start increasing.

Even though the search engines tell us only to do what is right for the visitors and want us to ask ourselves "would I do it if the search engines didn't exist?", this particular improvement is designed to specifically help the search engines understand how our website works, also bringing more search engine visitors to the website.

So what to do?

Naturally, you need to only have one version by redirecting one of the site versions to another.

If you want a shorter domain and your customers will be able to memorize and identify your address with the web, then you can go without www.

However, if you want to make it clear that the address belongs to the Web, use the www version.

Opinions split on which one to use, really.

To redirect from one version to another, you either need to edit your httpd.conf file, if you use a dedicated server, or update your .htaccess file in the root of the domain.

Edit httpd.conf of Apache configuration

Ron Carnell suggests using two blocks in the httpd.conf file:
‹VirtualHost 192.xxx.xxx.xxx>
ServerName domain.com
DocumentRoot /home/domain/www
‹/VirtualHost>

‹VirtualHost 192.xxx.xxx.xxx>
ServerName www.domain.com
Redirect 301 / http://domain.com/
‹/VirtualHost>

Basically, you only need to insert the correctly tweaked code in the corresponding part of your httpd.conf file (make sure you back it up first).

Please note that if you go this route, you'll need to tweak both parts, if one of the details changes.

If you are not familiar with the terminology and the whole process of fiddling with the Apache server, you'd rather designate this to your web admin.

If you read what Ron Carnell has said about this issue (you really should), you'll gain more insight why and how this is done.

Edit .htaccess in the domain root

But if you don't control the server, you can use the three lines of code:

How to redirect to www from non-www version:

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

(replace yourdomain.com with your domain)

How to redirect from www version to non-www version:

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

(replace yourdomain.com with your domain)

Note: using .htaccess adds overhead to the server, since it'll be processed on every request to the server. However, large websites are bound to use dedicated servers, so it is pretty smooth here.

The .htaccess file is a file named .htaccess in the root of your domain. It has various directives used to tweak server performance. You can edit it, insert the corresponding three lines of code at the top of it (change yourdomain.com to your domain) and upload it back to the server.

To test this, you'll need to refresh the page in the browser. If everything loads fine and you can go from one version to another by entering the redirected URL, it works.

If you get a 503 error, you need to make sure you have inserted the code correctly. If you can't do this after repeated attempts, remove your edition to let the server work again and contact a professional.

You can also read a mod_rewrite manual from Apache about redirecting with .htaccess.

Conclusion

Frankly, it amazes how many sites I see often that don't redirect to only one of the versions, thus leaving plenty of money on the table. The thing is, the amount of money doesn't matter, because it takes a couple of minutes of work to implement the changes by the web developer.

And the funniest thing is that depending on the site total traffic, the profit increase can be very noticeable, comparable to general marketing activities, such as increase of conversions, promotions, etc.

Topics: 

Comments

You know I'm surprised at how many times I've noticed well known SEOs failing to take care of canonical issues. I haven't caught it a lot, but when I have noticed it I was amazed. Canonical issues are one of the first things I'll look at when optimizing a site for a new client.

Same here. It is so easy to check for it (type in both versions and see if either redirects to another) and so easy to implement, it is simply amazing.

I absolutely love this idea and am amazed that it isn't common place amongst webmasters.
Although - and please don't take this the wrong way - I do have one small grammatical error to point out about your article as it really confused me for a moment. When you write "How to redirect to www from non-www version" and "How to redirect from non-www version to www version." These two sentences actually mean the same thing - in both instances you are redirecting from non-www version to www version.
I suggest a small wording change to the second option - "How to redirect TO non-www version FROM www version." This will fix any confusion someone else may have and assuage my pet peeve!
Thanks again for your interesting and extremely relevant articles!

Gabby, thanks fo the heads up. I guess I need to spend more time and effort checking the posts. Though, these 'to' and 'from' thing can get confusing at times ;)

I have fixed the wordings. Thanks again.

thanx a lot, i've implied this SEO on softwaredl.info , my client is happy though

You are welcome, though it doesn't look like it works on the site you specified. Going to www .domain.info should go to .domain.info or visa versa.

If you have a collection of rewrites and redirects to implement, you are better off using directives all from the same Apache module so that you can control the order in which they are parsed. Using RewriteCond and RewriteRule often allows greater flexibility of implementation, and of course does allow both redrects and rewrites to be implemented together.

You don't want to expose the workings of internal rewrites by having them run before any associated redirects. That can occur if they are coded using directives from different modules.

Domain canonicalisation is the first step. You also need to ensure that all internal links point to the correct version too. Visiitors browsing the site should not pass through any redirects when clicking internal navigation links.

Once you get started, you'll see many other uses for these directives and their close relatives.

One word of warning when uploading the .htaccess file. Most FTP programs hide filenames that begin with a dot. Make sure you edit that option, so you can see if there is a .htaccess file on the server already. If there is, then download that and edit it. Don't just overwrite the existing file, as you will lose all the settings that were already contained within it.

Thanks for the awesome addition, Ian. I guess diving further can't hurt, eh :)

You can also read about SEO and Google at Sebastian's Pamphlets.

Add new comment