301 Redirects: Why and How

DChapman

Devotee
Joined
May 20, 2004
Messages
2,880
DChapman submitted a new Article:

301 Redirects: Why and How

Open your browser of choice and type: [noparse]http://google.com[/noparse] into the address bar and hit enter. Watch closely, [noparse]http://google.com[/noparse] redirects to [noparse]http://www.google.com[/noparse]. 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 [noparse]http://domain.com[/noparse] to [noparse]http://www.domain.com[/noparse] (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, [noparse]http://domain.com[/noparse] and [noparse]http://www.domain.com[/noparse] are different pages on your website. The proof is in the PR (Page Rank). Let's take a look at a screenshot of [noparse]http://wikipedia.org[/noparse]. As you can see below, it shows a Google Page Rank of 7.

wiki7.png



Now let's look at [noparse]http://www.wikipedia.org[/noparse]. 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.

wiki8.png


Why should you care? A variety of reasons:

1. When people link to your site, some will link to [noparse]http://domain.com[/noparse] and others to [noparse]http://www.domain.com[/noparse]. 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 [noparse]http://domain.com[/noparse] to be counted as pointing to [noparse]http://www.domain.com[/noparse].

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 Guidelines, "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...

Read more about this article here...
 
Last edited by a moderator:
Joined
Apr 21, 2004
Messages
589
Fantastically written article sir, well explained and easy to follow. Thank you for taking the time to write it for us.
 

DChapman

Devotee
Joined
May 20, 2004
Messages
2,880
The Sandman said:
Nice tutorial! What exactly does this mean, and should we worry about it?
It's nothing to be concerned about. You can read more about the movement and the reasoning behind it here.
 

KeithMcL

Freelance Web Designer
Joined
Jan 12, 2004
Messages
5,728
Nice article indeed. I think I'll implement this on all my sites from now on. Thanks :)

By the way... if after you've taken these steps, how long (roughly) will it take for PR to be associated with the correct URL (if at all)? The reason I ask is that my blog has a PR 4 with and without www. Will it increase on the www one if I redirect?
 

Music Man

Keep Music Alive
Joined
Nov 13, 2005
Messages
1,162
Great article, thanks for taking the time to post it. :)

301's are something that new webmasters aren't usually familiar with, so hopefully this will help a lot of people with SEO at their site. Well done! :tiphat:

KeithMcL said:
By the way... if after you've taken these steps, how long (roughly) will it take for PR to be associated with the correct URL (if at all)? The reason I ask is that my blog has a PR 4 with and without www. Will it increase on the www one if I redirect?

Pagerank takes a while to update on the Toolbar, usually around 3 months. But it's quite possible that you may not see any difference at all. You may see a difference in PR eventually, but PR is so dynamic it may not have anything to do with your redirects. Information about PR and 301's are still very foggy when it comes to case-studies and information from Google. But the main points (SEO and navigation) will take effect immediately and will improve your site. ;)
 

DChapman

Devotee
Joined
May 20, 2004
Messages
2,880
KeithMcL said:
By the way... if after you've taken these steps, how long (roughly) will it take for PR to be associated with the correct URL (if at all)? The reason I ask is that my blog has a PR 4 with and without www. Will it increase on the www one if I redirect?
If you do a search for "301 redirect" on Google, you will find hundreds of people/sites stating that PR and links pointing to the old url are transferred to the new via 301 redirect. I used to think the same thing because everyone says that anywhere you look. It's the prevailing wisdom. And if you read it on the internet, it MUST be true, right? ;)

I no longer believe this to be true for the following reasons:

1. Google states in their information for webmasters:
If you've changed your URL, or plan to, and would like Google to display your new URL, please keep in mind that we can't manually change your listed address in our search results. That said, there are steps you can take to make sure your transition is smooth.

If your old URLs redirect to your new site using HTTP 301 (permanent) redirects, our crawler will discover the new URLs. For more information about 301 HTTP redirects, please see http://www.ietf.org/rfc/rfc2616.txt.

Google listings are based in part on our ability to find you from links on other sites. To preserve your rank and help our crawler find your new URL, you'll want to inform others who link to you of your change of address.
Why inform the people who link to you of your new address if the 301 redirect takes care of it for you?

2. I can think of some pretty nefarious ways to boost my own PR/rankings and hurt my competitors if this is true.

3. An incoming link is, in the eyes of Google, a "vote" that the page it is linking to is something a little special. If you, as a webmaster, move that page, then how do we know the person who initially linked to you would still view the NEW page as worthy of their vote?

Granted, I could very well be wrong, this is theory at this point. I have setup various test pages to check if my hypothesis is correct or not.
 

KeithMcL

Freelance Web Designer
Joined
Jan 12, 2004
Messages
5,728
I was going to say "there's only one way for me to know for sure", but of course in the time it takes Google (and other SE's) to deal with the redirect, other aspects might influence my PR, so there isn't anyway to tell for sure (without running tests like you are).

I'll just implement the redirect and be happy in the knowledge that I have things setup for the better :)
 

BrandonSheley

loving life
Joined
Jan 2, 2006
Messages
2,607
thanks for this article..
i had an idea on what a 301 redirect was, but this made it plain and simple to understand :)
 

hovercrafter

Participant
Joined
Mar 7, 2006
Messages
60
If you are using WordPress which writes an htaccess file for the permalink structure then simply add this code below the #end wordpress and it works great!
 

DMB

vBulletin User
Joined
Jul 5, 2005
Messages
1,698
Sorry about that, it must of been my cache or something :whistle:
 

DChapman

Devotee
Joined
May 20, 2004
Messages
2,880
morbidpalooza said:
It would not let me rename htaccess.txt to .htaccess why?
Did you try to rename it AFTER you uploaded to FTP? If you do it before you're going to run into problems.

If so, do you already have a .htaccess file present? What error message did you receive?
 

MrMan

Neophyte
Joined
Mar 9, 2006
Messages
8
morbidpalooza said:
It would not let me rename htaccess.txt to .htaccess why?

Because you're renaming it to a file with no filename.
filename.extension

So what you must do is open htaccess.txt.
Click File -> Save As
In File name: type: ".htaccess" (with the quotes included!)
Click Save.
 

halfway

Aspirant
Joined
Mar 13, 2006
Messages
34
I owe you an apology [zoints]dchapman. Sorry, I didn't realise this excellent tutorial was here until now and I was trying to help PalePhoenix in an older thread with the same thing. I had seen mention of your name there and it's only just twigged when I saw this thread.

Wish I had seen this when I was looking for information about redirects, you've explained it so much better than anywhere else I found. :)
 

cm_assassin

Aspirant
Joined
May 15, 2006
Messages
28
I've noticed I already have a .htaccess file uploaded...

My .htaccess file already contains:
<Files config.php>
Deny from all
</Files>


Should I add this 301 code underneath in that file? or what?
 
Top