When Google indexes sites, it sees URLs with and without the preceding www as entirely  different sites. Referred to as the Google canonical problem, this indexing approach can negatively affect your PageRank as some inbound links to your site may include the www while others may not, which divides the number of links to your site from Google’s perspective and splits your PageRank. You can tell if your site is suffering from the Google canonical problem by checking the PageaRanks, then you’ll want to fix this issue. We can solve the problem using an Apache module called mod_rewrite, which can automatically map all requests to a single, consistent format.

Mod_rewrite is a handy Apache module that rewrites URLs when specified patterns are detected. It’s exceptionally powerful, and can provide solutions to a number of SEO-related challenges including powerful, and can provide solutions to a number of SEO-related challenges including the Google canonical problem. We’ll use it to execute to a 301 redirect, sending the user’s browser to a URL with the www included in the URL.

Servers provide different HTTP status codes to indicate to a response to a request . You’re probably familiar with a 404 status code that indicates the page requested was not found. A 301 status code is a redirect from the URL requested to another one specified by the server administrator.

To send out a 301 redirect status code, create a file called htaccess.txt with the following code to give Apache following code to give Apache the message:

Force WWW

RewriteEngine On

RewriteCond %{HTTP_HOST} ^revival.com$ [NC]

RewriteRule ^(.*)$ http://www.revivalx.com/$1 [R=301,L]

This code uses regular expressions to locate specific patterns when evaluating URLs. Regular expressions are commonly used in many scripting and programming languages to identify patterns is strings- a series of text characters. They can be intimidating because of the cryptic characters they use to locate specific text, and aren’t exactly an intuitive read without some prior research.

In this example we see strange characters that indicate text pattern scenarios  . For example, the ^indicates the start of the string, and the $ indicates the end of the string. Each special character has some pattern matching meaning . You can print out a quick reference to demystify regular expressions at http://www.ilovejackdaniels.com/cheat-sheets/regular-expressions-cheat-sheet .

Now that you’ve got your rewrite code in place, upload the htaccess.txt file to the Web root of your server , then rename it to .htaccess. Naming the file .htaccess locally can cause problems, as it a reserved name recognized by some operating systems such as Mac OS X, which would automatically hide it.

In case you are new to working with Apache, the .htaccess file provides on the fly configuration commands to the server and the various modules associated with it. Apache looks for this file whenever it needs to send out a response , and supports the use of unique .htaccess files in different directories for very granular control of the server’s configuration. We’ll be using it often to configure Apache to meet our findability goals.

The first line in the code example turns mod_rewrite on, and the next one sets a condition to be on the lookout for any page request with the domain name in the URL. Of course, revivalx.com will need to be changed to your domain name in order for this to work. The last line creates a rewrite rule that redirects users to their intended destination with the www in the URL.

If you’d like to do the inverse and remove the www, just make sure your rewrite condition contains the www, and remove it from the rewrite rule.

Remove WWW

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.revivalx.com$ [NC]

RewriteRule ^(.*)$ http://revivalx.com/&1 [R=301,L]

There is one other way to ensure Google is using the desired URL structure when ranking your pages. The Google Web Master tools at http://www.google.com/webmasters/sitemaps/ .

Bookmark and Share
Share This Post
Subscribe to comments Comment | Trackback |
Post Tags: , , ,

Browse Timeline




Your Ad Here

Comments ( 2 )

[...] more:  Solving the Google Canonical Problem | art,website and SEO By admin | category: website seo | tags: engine, entirely-different, grab-it-now, gross, [...]

Solving the Google Canonical Problem | art,website and SEO SEO Solutions added these pithy words on Dec 25 09 at 9:36 pm

[...] the original here: Solving the Google Canonical Problem | art,website and SEO By admin | category: google seo | tags: adwords, determine-the-whether, [...]

Solving the Google Canonical Problem | art,website and SEO Search Engine Optimizer added these pithy words on Dec 26 09 at 2:35 am

Add a Comment


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


© Copyright 2007 art,website and SEO . Thanks for visiting!