Many of my clients are concerned about the loss of "link juice" when moving their public facing site to SharePoint. The issue is easy to understand. Even if you keep the structure of your site exactly the same as your current site, SharePoint forces the inclusion of the "pages" library in the URL. This means that moving www.mycompany.com/default.aspx to SharePoint will become www.mycompany.com/pages/default.aspx. In general this is not a problem because accessing www.mycompany.com will redirect to the default welcome page. The problems my clients have are three specific issues:
- Links to the site from other sites will no longer work.
- Links saved by users as browser favorites will no longer work.
- Search engines have already crawled the original site, selecting a link in the search results will no longer work.
I recently moved my blog of three years from my previous employer to my new company. I am still on great terms with them, so I asked if we could redirect requests to my old blog to my new blog. I wanted any request for content from my old blog to redirect to my new blog. I wanted the EXACT page to be loaded. Finally, I wanted the redirect to return a 301 Permanent redirect, to indicate that the content was moved to a new location. This scenario is exactly what most of my clients want to do. If you are removing content you can set up additional rules that will send your users to "equivalent" content on your new site.
IIS 7 URL Rewrite Module
The URL Rewrite Module for IIS7 is a free download that can be used to meet all of our needs. Though named "rewrite", this module supports redirection as well. This module is very powerful and, once you get the hang of it, easy to use because it supports regex pattern matching (not that regex is at all easy…). The best part is that the module is supported by a community of folks who know a whole lot more about regex than I do.
Once installed. In IIS 7 locate your original site and choose the URL Rewrite module.
From the Actions menu choose Add Rule(s).
Create a new blank inbound rule.
Give the rule a unique and descriptive name and supply the required values. For example, in the rule below I was redirecting from blogs.mycompany.com/matthew to www.ableblue.com/blog so I set the condition to match any request to "matthew or below".
|
Match URL |
|
|
Requested URL: |
Matches the Pattern |
|
Using: |
Regular Expressions |
|
Pattern: |
(.*) |
|
Ignore Case: |
True |
|
Conditions |
|
|
Logical grouping: |
Match All |
|
Condition Input: |
{URL} |
|
Check if input string: |
Matches the Pattern |
|
Pattern: |
/matthew(/.*) |
|
Ignore Case: |
True |
|
Action |
|
|
Action Type: |
Redirect |
|
Redirect URL: |
http://www.ableblue.com/blog{C:1} |
|
Append query string: |
True |
|
Redirect type: |
Permanent (301) |
Test the Condition using the Test Pattern button. If you enter a URL like: "http://blogs.mycompany.com.com/matthew/archive/2010/11/22/one-week-with-my-windows-phone.aspx" it should produce a {C:1} capture of everything below "matthew/". If you enter: "http://blogs.mycompany.com/IT/archive/2010/11/14/exchange-2010-sp1-and-blackberry-enterprise-server-express.aspx" it should not match the pattern.
Here is what my finished rule looks like.
You can create multiple rules to handle different cases for your site such as:
- Moving content from one location to another
- Handle the addition of the "pages" library
- Redirection for Vanity URLs that are part of a marketing campaign
- Transition from HTML, PHP, CFM etc. to ASPX file extensions



Matthew,
interesting – I want to do a step by step migration from 2007 to 2010. This approach is much better than having redirect pages in 2007 pointing to migrated content.
Matt,
Probably a ways out before we transition our CFM based internet site to SharePoint, but I am just starting to gather info and find solutions. The rewrite was my main concern from an seo perspective. Looks like a great solution. Thanks!
Take into account that Sharepoint does not support URL rewrite (see http://technet.microsoft.com/en-us/library/cc261814(office.12).aspx, it also applies to 2010). So, in Sharepoint, you can use the IIS rewrite module to redirect URLs, but not for rewrite URLs.
Andres, right, I am not suggesting rewriting at all (unfortunate that the IIS Module is named that way). I am simply doing a SEO friendly Redirect.
I have a requirement of to rewrite http://blog.testurl.com/Lists/Posts/Post.aspx?ID=1 to http://blog.testurl.com/test title for blog/. Can you please help me to achieve this?
Sudhish, URL rewriting is not supported by SharePoint 2010. You can look at custom solutions for Blogs specifically like CKS:EBE http://cks.codeplex.com
I have a requirement to set up redirection of sharepoint sites from X.com:81/default.aspx to y.com:27883/sites/xyz/default.aspx. Can we setup this using URL redirection
Praveen, Yes, easy. But I have to ask, why do you have pport numbers in your URLs? I find users have a hard time with them. Anyway, yes you can redirect that way.
Matthew, this blog post (http://blog.mastykarz.nl/friendly-urls-sharepoint-site-4-steps-iis7-url-rewrite-module/) seems to suggest that URL rewriting in SharePoint is possible using the IIS7 module, but your comments and those of Andres disagree?
Hi Matthew,
I have a question. I have a SP 2007 site on Windows 2003 server and SP 2010 site on Windows 2008 server, connected in same network. The SP 2010 site have host headers in it. When user try to hit the 2007 site it needs to be redirected to the 2010 site. Both 2007 and 2010 sites are on different servers. Can i use your solution IIS Rewrite to redirect to the new sites.
Matt, I did not say it couldn’t be done. I just said if you run into problems it’s not supported.
Venkat, it depends on the version of IIS you are running. The Rewrite module is for IIS7.