A A A Font Size

helloitsliam

MOSS2007 – 302 to 301 “Pages” Redirect

As most of you will no doubt know, SharePoint uses 302 to redirect pages and sites to the default pages. In a good external site you would really want these to be changed to 301 redirects. What are these redirects and what do they do?

Permanent 301
Permanent 301 redirects are just as they sound. They are permanent redirects from an old URL to a new one. These redirects tell the search engines that the old location is to be removed from their index and replaced with the new location. Using 301 redirects is the most search engine friendly way to redirect traffic and engines, and far outweighs that of various JavaScript and Meta refresh redirects.

Temporary 302
Temporary 302 redirects are also as they sound; temporary. Here you are telling the search engines to read and use the content on the new page, but to keep checking the original URL first as it will ultimately be reestablished.

The main issue with 302 headers is that the redirected locations don't get crawled by search engines which don't follow temporarily moved pages. This is not an issue for intranet sites normally but for external sites this is a problem.

There are tons of ways of fixing this, a few are the following:

http://www.thesug.org/Blogs/lsuslinky/archive/2009/04/17/Fixing_the_302_redirect_problem_in_SharePoint_.aspx.aspx

http://vettekerry.wordpress.com/2008/09/09/moss-seo-302-pages-redirect/

http://blog.seo-hardcore.com/caching/sharepoint-2007-301-redirects

http://www.sharepointblogs.com/tmt/archive/2008/01/21/sharepoint-2007-redirect-solved-using-301-instead-of-302-redirects.aspx

To add to the list I decided to simply add some code to the "Global.asax" file. This is only a temporary fix, as the proper way of doing it would be to use an Http Handler. I know there are lots of pros and cons to using the "Global.asax" within a SharePoint environment but for this *quick* fix it worked okay.

Now for my requirement I simply needed to ensure that when someone typed: http://www.sharepointsite.com/Pages/ that it did a redirect using 301 not 302. The redirection from the site URL of http://www.sharepointsite.com, had already been fixed using a Http Handler, however the functionality for the pages redirect was not in this version. So let's look at what it does to begin with. I am using the following URL on my laptop:

When I access this site you can see using Fiddler that a 302 redirect takes place.

Now with the code block below the following happens:

NOTE: The code block is very simple, not the most elegant code but as stated before should really be developed into an Http Handler.

 
Now I know that this is the ideal approach to resolve this issue so this is just an idea of what can be done to fix this issue without having to write a full module that fixes this. You can take the code you would write for the handler and use that within the "Global.asax" as well if needed.

 

You must sign in to rate content.
(1 ratings)

Comments

Why Internet Search Engines Don't Like Redirects

Why Internet Search Engines Don't Like Redirects

Below is a snippet from Google’s Webmasters SEO page to help explain why internet search engines don't like redirects: 

“One common scam is the creation of "shadow" domains that funnel users to a site by using deceptive redirects. These shadow domains often will be owned by the SEO who claims to be working on a client's behalf. However, if the relationship sours, the SEO may point the domain to a different site, or even to a competitor's domain. If that happens, the client has paid to develop a competing site owned entirely by the SEO.”

Sean Bordner at 5/15/2009 11:01 AM
You must sign in to rate content.
(Unrated)

Why Internet Search Engines Don't Like Redirects

Why Internet Search Engines Don't Like Redirects

Below is a snippet from Google’s Webmasters SEO page to help explain why internet search engines don't like redirects: 

“One common scam is the creation of "shadow" domains that funnel users to a site by using deceptive redirects. These shadow domains often will be owned by the SEO who claims to be working on a client's behalf. However, if the relationship sours, the SEO may point the domain to a different site, or even to a competitor's domain. If that happens, the client has paid to develop a competing site owned entirely by the SEO.”

Sean Bordner at 5/15/2009 11:01 AM
You must sign in to rate content.
(Unrated)

Why Internet Search Engines Don't Like Redirects

Why Internet Search Engines Don't Like Redirects

Below is a snippet from Google’s Webmasters SEO page to help explain why internet search engines don't like redirects: 

“One common scam is the creation of "shadow" domains that funnel users to a site by using deceptive redirects. These shadow domains often will be owned by the SEO who claims to be working on a client's behalf. However, if the relationship sours, the SEO may point the domain to a different site, or even to a competitor's domain. If that happens, the client has paid to develop a competing site owned entirely by the SEO.”

Sean Bordner at 5/15/2009 11:01 AM
You must sign in to rate content.
(Unrated)

Leave a Comment

You must be logged in to post a comment.
Superstar
Liam Cleary
Senior Solution Architect | SharePoint MVP
SUSQTECH
Sheffield, UK
Liam is working as usual, SharePoint, SharePoint and then some more SharePoint!!

Search This Blog

 

© 2010 SusQtech. All rights reserved.
Powered by SharePoint Server 2007 and using the MemberToMember SharePoint Add-On for social media capabilities.