Quantcast

All, All stuff, How to

301 Redirects: Why and How

0 Comments 15 March 2010

Open your browser of choice and type: http://google.com into the address bar and hit enter. Watch closely, http://google.com redirects to http://www.google.com. This is because Google has a “301 redirect” setup. A 301 redirect is a permanent redirect of one webpage to another. There are many different ways to utilize a 301 redirect. For the purpose of this article, we will only discuss the redirect of http://domain.com to http://www.domain.com (or vice versa) via .htaccess. What is the point of this 301 redirect and how do you properly implement one?

What is the point of 301 redirects?

Believe it or not, in the eyes of search engines, http://domain.com and http://www.domain.com are different pages on your website. The proof is in the PR (Page Rank). Let’s take a look at a screenshot of http://wikipedia.org. As you can see below, it shows a Google Page Rank of 7.

Now let’s look at http://www.wikipedia.org. As you can see in the screenshot, it shows a different Page Rank; a Page Rank of 8. It is viewed as a different page.

Why should you care? A variety of reasons:

1. When people link to your site, some will link to http://domain.com and others to http://www.domain.com. This causes your PR to be spread out over different pages instead of just one. The prevailing wisdom (I don’t believe it, but that’s an article for another time) is that a proper 301 redirect will cause the links that are pointed to http://domain.com to be counted as pointing to http://www.domain.com.

2. Potential duplicate content penalties. Anytime you have the same content on two different pages, you risk incurring a “duplicate content” penalty. As Google says in their webmaster guideline, “Don’t create multiple pages, subdomains, or domains with substantially duplicate content.” Now, Google is usually pretty good at canonicalization (the process of picking the best url when there are various choices) but a proper 301 redirect removes the guesswork and ensures the url you prefer to to be displayed is in fact displayed.

3. Cookie issues. Depending on how the cookie domain is set, the two urls may have different cookies sent to them, which may produce inconsistent page content.

4. Nice, clean navigation. One of the most important aspects of SEO is creating nice, clean navigation for the bots to follow. You might as well start at the index with a proper 301 redirect.

5. Because everyone is doing it, including Google. If Google jumps off a bridge, so should you.

How to setup a proper 301 redirect

The process of setting up a 301 redirect on an Apache server is quite simple. How to implement one on a non Apache server is an article in itself. Please note that you must have mod_rewrite installed on your server for this to work.

Step 1. Create a normal .txt. file and name it htaccess.txt

Step 2. Cut and paste the following code (replacing “yourwebsitename” with your website’s name:

Code:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourwebsitename\.com
RewriteRule ^(.*)$ http://www.yourwebsitename.com/$1 [R=permanent,L]

Step 3. Save the file and upload it via FTP to the root folder of your website.

Step 4. Rename the file to .htaccess

Upon submitting the name change, the .htaccess file will disappear in many FTP programs. That’s normal. You can test to see if it is working correctly by typing in http://yourdomain.com and checking if it automatically changes to http://www.yourdomain.com

Some people prefer to redirect http://www.domain.com to http://domain.com because they hold the opinion that www is deprecated. You fine folks can use this code instead:

Code:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.yourwebsitename\.com
RewriteRule ^(.*)$ http://yourwebsitename.com/$1 [R=permanent,
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • Add to favorites
  • email
  • LinkedIn
  • MySpace
  • Netvibes
  • SphereIt
  • StumbleUpon
  • Technorati
  • Tipd
  • Tumblr
  • Twitter
  • Upnews
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Related posts:

  1. Better Search Engine Rankings with RSS
  2. How to get pagerank?
  3. How To Remove user titles W/ user ranks
  4. » Learning PHP for the first time
  5. 5 Best Seo Addons for Firefox

Share your view

Post a comment

Subscribe

Enter your email address:

Delivered by FeedBurner

facebook

mytechnolife on Facebook

Friend Connect

donation

DOFOLLOW BLOG

  • No commentators.
Get Adobe Flash playerPlugin by wpburn.com wordpress themes

© 2010 Mytechnolife. Powered by Wordpress.