“Fix” SharePoint 302 redirect problem by IIS7 and URL Rewrite

“Fix” SharePoint 302 redirect problem by IIS7 and URL Rewrite

Rate This
  • Comments 4

Recently in my spare time I’m helping my friends to get their internet facing sharepoint site up and running. Since this is for the internet, the first thing they need to consider is SEO. So we have a well known problem now: SharePoint use 302 temp redirect instead of 301. If you do a search for “sharepoint 302” you will see a lot of articles talking about the problem.

Here’s the default SharePoint Site. The request was temporarily redirected (302) to Pages/default.aspx. Search engine bots don’t like it, they like 301. So this is BAD.

snap006 

How to solve it? Oh, I’m a IT Pro person, I don’t want to deal with a custom redirect HttpModule – god knows what will happen if those custom code mess up my sites! So any other options?

I’m lucky because I installed SharePoint on Windows Server 2008, so I can use IIS7 features. I downloaded URL Rewrite module from http://www.iis.net/extensions/URLRewrite, installed it, and started to configure the redirect.

snap007

Choose your site in IIS Manager, click URL Rewrite, and create a new blank rule.

Use Regular Expressions to match ^$ (which means “empty”). Set Action Type to Redirect, and add the redirect URL (by default should be Pages/default.aspx), set redirect type to Permanent (301). You are all set!

snap005

 

 

 

Now, clear browser cache and revisit the site:

snap004

It is 301 now! Pretty easy, isn’t it?

URL Rewrite module is great. If you are a regex guru you can also create more complex rules to make everything fit for your site.

Leave a Comment
  • Please add 2 and 5 and type the answer here:
  • Post
  • I used to have the issues with 302 redirect. My developers didn't take it serious and the result was my site's snippet terribly changed in Google SERPs.

  • Hi Jie Li, thanks for the great information.  I have the same problem but with IIS 6 and sharepoint.  How can this be solved.  My programmer has tried to solve it but it effectively creates an endless loop. SharePoint temporarily redirects to the default page and the default page is permanently redirected back to the root by IIS.  How can this be solved, thanks in advanced

  • Re: II6 and SharePoint

    There is an ISAPI module developed by Helicon that works well.

  • Hi Jie Li,

    This is great solution if you can know all your welcome pages are named "default.aspx" Do you know if there is a rule using URL rewrite or other solution that would be smart enough to redirect you to the welcome page instead of just default.aspx?

    Thanks!

    Tonny

Page 1 of 1 (4 items)