RDA Corporation

Blog

SharePoint URL Redirector available for download on CodePlex

By Jason Barron on June 1st, 2009 // 35 Comments

On CodePlex: http://rdacollaboration.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28073

So, sometime last year, RDA engaged in a project with a client to migrate a SharePoint 2003 environment to SharePoint 2007. After some initial planning, we determined that a one-time content database migration was going to be the best approach. However, we had a few complications to consider:

  1. When using this upgrade path, SharePoint 2007 takes some liberties with the URL structure of the sites once the databases are attached to the 2007 environment and upgraded. For example, the familiar “C” addresses of 2003 (Ex: http:\sharepoint2003C10HR) were converted to “Topics” (Ex: http:\sharepoint2003TopicsHR).
  2. The client was not incredibly happy with their existing site taxonomy in general and wanted to take the opportunity to rearrange their sites as part of the upgrade.

The problem: The project would be considered a failure by the user community if everyone lost their IE favorites and links already embedded in content. We needed a solution to redirect URL requests from the old URL schema to the new locations.

Todd Klindt has an excellent article on different options for implementing redirection in SharePoint. Check it out here: http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=48

Upon reviewing the various options, I decided that none of the techniques would really work for the size and scope of what was needed. We needed:

  1. A way to define redirection farm-wide – for hundreds of sites. Not just one-off rules for redirecting single pages or sites.
  2. A way to redirect all URLs for ALL content under a site – not just the first page of the site. If the user linked to an image 15 folders deep in a site, that link should still function even if the site is moved or renamed.
  3. Immediate redirection – no 5 second wait for redirection pages. Ideally, the user shouldn’t even realize they’ve been redirected.

So, I decided to build the SharePoint URL Redirector. I’ve released a binary, documentation and source code on CodePlex here:

http://rdacollaboration.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28073

The SharePoint URL Redirector features:

  • Regular Expression based rules – Permits massive flexibility in redirecting content requests. Entire sites of content to be redirected to other locations in a single rule. Not just single pages.
  • Test Driven Design – Built-in testing interface simplifies the design and upkeep of redirection rules. Immediately see conflicting rules or URLs that are no longer valid.
  • Centralized Rule Management - UI for maintaining rules is integrated into SharePoint Central Administration.
  • Immediate Redirection – Redirection is immediate. Users typically don’t even notice that they’ve been redirected from their original URL. No annoying “You’ll be redirected in 5 seconds” pages.
  • Scalable – Creatively caches rules and translations to maintain page-load performance. Has been tested with hundreds of redirection rules utilized with no perceived difference in page load times.
  • Ability to copy rules – Rules can easily be copied to other SharePoint web applications.
  • Chainable - Complex redirection can be performed by chaining multiple rules.

In the end, using this solution, we successfully provided seamless redirection for all content in over 350 sites (and many many more sub-sites). Most user’s have never noticed a difference. Since then, several other RDA’ers have utilized it on their projects for other reasons such as:

  • Accommodating Site Moves – If you ever have to relocate a site to a new site collection because it’s gotten too large and needs its own content databases, you can redirect the old URL scheme to the new one. No need to have to explain to users why you moved their site and broke their IE favorites.
  • Fill in holes in the URL scheme of your site – For example, if all of your sites are located under http://company.com/sites/* (a wildcard managed path), then there is no page directly under http://company/sites. Redirect that URL to a site directory or home page for a better overall experience for users of your environment.
  • Vanity URLs – Configured properly, you could setup a vanity URL at http://finance.company.com that redirects the user to the real site at http://depts.company.com/sites/finance. Sometime soon, I’ll post an article on exactly how to do this.

So, please check it out. I highly suggest reading the documentation posted on CodePlex with the tool, and utilizing the test-driven approach to defining rules. It’s really fun to see the green indicator light up after you successfully define and test a rule! Also, if you’re unfamiliar with Regular Expression syntax, a pretty good overview can be found here: http://www.codeproject.com/KB/dotnet/regextutorial.aspx

About the Author:

  • http://www.blogger.com/profile/06015840776034539986 Paul

    Hmm, I just get the dreaded Unknown Error (Go Back To Site) page when I click my newly created URL Redirector Application Management link…:(

    Used the install.cmd batch file, and it added & deployed ok, judging by the new link in app management.

    Any thoughts?

    P.

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    Couple of things to try:

    - Execute 'stsadm -o execadmsvcjobs' and retry.

    - Check to see if you have access to write to 'InetpubwwwrootwssVirtualDirectories[Web App]_app_bin'.

    Let me know if either of those work.

    Thanks!

  • Anonymous

    i deployed the redirector ok but when i try to use it the is the following message.

    The 'URL Redirector' feature is not activated for this Web Application. Changes below will not have an effect.

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    Yes – you need to go out to "Central Admin -> Application Management -> Manage Web Application Features" and activate the "URL Redirector" feature for whichever web apps you want to apply redirection rules.

    The rule editing screens are accessible for all web apps, but the rules you define will only have an effect for those web apps that have the feature turned on.

  • Jon

    Hi Jason;
    Thank you for developing this great app.
    I'm having a slight problem with it in our production environment though. In Central Admin when I click on the linkk to go to the app I receive the below error meessage. We have 2 web front ends and 2 index server. Central Admin is running on the index server. The permissions have been applied correctly on the _app_bin directory. I also copied a urlmapping.xml file from the dev machine to the prod machines and it will forward correctly using the xml file. I just cannot get the webapp to run correctly.

    Any help would greatly be appreciated.

    Regards – Jon

    The resource object with key 'Title' was not found. at System.Web.Compilation.ResourceExpressionBuilder.ParseExpression(String expression, Type propertyType, ExpressionBuilderContext context)
    at System.Web.UI.BoundPropertyEntry.ParseExpression(ExpressionBuilderContext context)
    at System.Web.UI.ControlBuilder.FillUpBoundPropertyEntry(BoundPropertyEntry entry, String name)
    at System.Web.UI.ControlBuilder.AddBoundProperty(String filter, String name, String expressionPrefix, String expression, ExpressionBuilder expressionBuilder, Object parsedExpressionData, Boolean generated, String fieldName, String formatString, Boolean twoWayBound)
    at System.Web.UI.ControlBuilder.PreprocessAttribute(String filter, String attribname, String attribvalue, Boolean mainDirectiveMode)
    at System.Web.UI.ControlBuilder.PreprocessAttributes(ParsedAttributeCollection attribs)
    at System.Web.UI.ControlBuilder.Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String id, IDictionary attribs)
    at System.Web.UI.ControlBuilder.CreateBuilderFromType(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String id, IDictionary attribs, Int32 line, String sourceFileName)
    at System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty)
    at System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText)
    at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)

  • http://www.blogger.com/profile/13546590803890381010 Ramu Pulipati

    Execute "stsadm -o copyappbincontent" on SharePoint server and try again.

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    Jon – similar to Ramu's suggestion, it sounds like the resource files did not deploy correctly. There are 2 resource files (deployed to '12TEMPLATEFEATURESURLRedirectionResources'):
    - urlredirection.resx
    - urlredirection.en-US.resx
    These files need to be copied to '12Resources' and to 'App_GlobalResources' under the IIS directory for Central Admin.

    If you copy then over manually, that should resolve your issue. It's tough to say why they didn't deploy correctly in the first place. Is your 'Windows SharePoint Service Timer' service running? You might also check the SharePoint logs for any errors related to the 'RDA – Url Redirection – Deploy Resource Files' job. If you see anything suspicious, post it here.

  • Jon

    Thank you Jason and Ramu,
    Copying the files from 'App_GlobalResources'

    Regards – Jon

  • http://www.blogger.com/profile/06015840776034539986 Paul

    Jason, your first suggestion,

    'stsadm -o execadmsvcjobs'

    did the trick for us; exec'd the command and voila, one working URL Redirector function!

    Now to figure out the syntax we need…;¬)

    Many thanks,

    P.

  • http://www.blogger.com/profile/12056352994099480424 darsh

    i have installed the RDA control on my site successfully, its working fine but only with the system account and not with other users. please suggest anything anybody.

    its giving me 403 forbidden error when i login with other users

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    I added a release note about this on the CodePlex site. I think this is the issue your seeing:

    "This release requires all users to have read access to the _app_bin directory under the site's virtual directory (ie: C:InetpubwwwrootwssVirtualDirectories[VirtualDirName]_app_bin). Further, the app pool account for the Web Application needs to have read/write permissions to this same directory."

  • http://www.blogger.com/profile/08340580464424064808 Brian Denicola

    Hi. Great addon for SharePoint. I got everything working on my development machine which is only one server. but when I deploy this to my test environment I get an error when deleting a mapping. The error is:

    The object with id f4ce992a-e3d6-443e-b859-8f8774a04ee1 does not exist in the configuration store. The object may have been deleted by another operation.

    The test environimetn has two servers (one web and one index/central admin).
    During the install, I had to copy the UrlMapping file from the Web Application server to the Central Admin server. And when I delete a mapping, it removes it from the UrlMapping on the Central Admin server but not the web server.

    Brian

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    Sounds like it might be permission related. Check which account the SharePoint Timer Service is running under and make sure it has read/write access to the "_app_bin" folder and the UrlMappings.xml file in it, under the Web Application's virtual directories on each server (C:InetpubwwwrootwssVirtualDirectories[VirtualDirName]_app_bin). Also, check to make sure that all users have read access to that directory and the UrlMappings.xml file.

    Respond back if that doesn't get it.

    Also, have you extended any of the Web Apps on your test environment into a new zone? If so, it won't copy correctly to the extended zones. That will be fixed in a future version.

    Thanks!

  • Anonymous

    Thank you for this great redirection tool. I have it working in our production environment with the following original and destination URLs configured: http://(?^/]+)(?/[wW]+)(?/[^?$]+)(??[^$]+)?
    and https://Intranet.DirectRelief.org$site$page$querystring

    In Test URL Mappings I pass with green indicators, and in the real world it works perfect. original: http://intranet/pages/default.aspx
    destination: https://intranet.directrelief.org/Pages/Default.aspx

    The problem is I want to redirect users with the following original URL: https://intranet/pages/default.aspx
    destination: https://intranet.directrelief.org/Pages/Default.aspx

    when I create the same URL mapping as the one above but change the Original URL to: https://(?^/]+)(?/[wW]+)(?/[^?$]+)(??[^$]+)?
    and leave the destination the same as above: https://intranet.directrelief.org/Pages/Default.aspx
    note: I only changed the original URL from HTTPS from HTTP

    When I test the URL mapping I get green for the mapping and yellow for the links and it presents the following error "The object with id 47736447-7084-4cc6-81c9-529dd57cfb7c does not exist in the configuration store. The object may have been deleted by another operation."
    Finally the pages load but the theme and page layout is drastically wrong. Also, the URL that is returned to me looks like this: https://intranet.directrelief.org/Pages/Default.aspx?&Redirect;=5

    It looks like it is redirecting 5 times.

    Any help is greatly appreciated.
    Aaron

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    Aaron – it appears that the redirection rules are getting into an infinite loop. It short-circuits at 5 loops – which it why you see the Redirect=5. Try changing the Regular Expression on your second rule to match the expected server name (instead of *any* server name) Ex: http://intranet/(?[wW]+)… That should prevent the infinite loop. If it doesn't resolve the UI problems, tell me more about your Web App & Alternate Access Mapping config and I will try to help.

    As for the error you see on the Test screen: 'The object with id % does not exist in the configuration store', you can ignore that I think. It's an issue I've been investigating with some environments with multiple web front ends. It should work fine in spite of that particular error.

  • http://www.blogger.com/profile/08167712238741526521 Matty

    Hi,

    I have a question about where the redirection is taking place. Is it at an ISAPI, HTTP, ASP.NET layer or at the web application itself? I am thinking of SEO here.

    Thanks

  • Sean

    After deploying the solution both using the install.cmd as well as using stsadm…

    I receive no errors throughout the process however, I do not see any options for RDA or URL Redirector in Application Management.

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    Matty – The solution uses an HttpModule (ASP.NET layer) to intercept requests to the web and redirect them. The HttpModule is registered in the web.config for the SharePoint Web Application, so the effect is scoped to whatever is covered by the web.config.

    I don't know that much about SEO really, so I'd be interested to hear the ramifications of my approach with respect to SEO.

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    Sean – the Feature is set to auto-activate on the Central Admin Web Application. Sounds like it may not have for some reason. Take a look at the Web Application Features screen for the Central Admin Web App and see if the "URL Redirector" Feature is activated. If not, activate it and you should see the link show up under Central Admin -> Application Management.

  • Sean

    URLRedirector does not appear under the web applications feature management page either. I had checked this initially thinking that it may have simply not activated properly in the first place… No Joy.

  • Anonymous

    F5 load balancer doesn't work with URL redirector. Any solutions?

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    I'm not very in-depth on load balancer configs, but I'll try to help.

    If it helps, the URL Redirector is fairly simple in what it's doing. It captures incoming requests, matches the URL against a list of URLs to redirect, and, if matched, redirects them with a 302 redirect to the new URL.

    What kind of behavior are you seeing? Have you verified it is working when you don't go through the F5?

    Thanks

  • http://www.blogger.com/profile/06847662805830466708 Josh

    I'm having an issue redirecting URL's with %20 spaces in them. I've tried an escape character before the % but it still does not work. The weird thing is, when I set up a TEST for it, it succeeds, but from the browser nothing happens.

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    Josh – If you use a space instead of the '%20' code in your "Original Url", that should work.

    I do think you found a little bug in that the "Test" is not functioning exactly like the real redirect for some reason. I'll look into it.

    Thanks!

  • http://www.blogger.com/profile/06847662805830466708 Josh

    Jason, that seems to have done the trick. Thanks so much. This add-on is amazingly useful.

  • http://www.blogger.com/profile/10115476603290489186 dunxd

    I am getting the 403 error. I have checked the _app_bin folder has Read acccess for Everyone, and Read/Read&Execute;/List Folder Contents permissions, and App Pool Identity and WSS Timer Service account have all above + Write.

    I do not see a UrlMappings.xml file in the _app_bin folder on my WFEs, only the server running Central Admin.

    I am running a 3 server farm – 1 CentralAdmin/Index server and 2 WFEs.

  • http://www.blogger.com/profile/10115476603290489186 dunxd

    I figured maybe I needed to set up the permissions before deploying the solution, so undeployed, then double checked the permissions and redeployed.

    Still, after activating the feature in a Web App, all pages give the 403 error. The UrlMappings.xml file is still missing from the _app_bin folder on the WFEs.

    Looking at the Application logs on the WFE, I can see the following related error:

    Event Type: Information
    Event Source: ASP.NET 2.0.50727.0
    Event Category: Web Event
    Event ID: 1314
    Date: 12/08/2010
    Time: 08:46:53
    User: N/A
    Computer: SI144
    Description:
    Event code: 4011
    Event message: An unhandled access exception has occurred.
    Event time: 12/08/2010 08:46:53
    Event time (UTC): 12/08/2010 07:46:53
    Event ID: f839cd7e0b6844cab1e7d38f0eb7263c
    Event sequence: 2
    Event occurrence: 1
    Event detail code: 0

    Application information:
    Application domain: /LM/W3SVC/792804208/Root-8-129260728116207758
    Trust level: WSS_Minimal
    Application Virtual Path: /
    Application Path: C:InetpubwwwrootwssVirtualDirectoriesIntranet80
    Machine name: SI144

    Process information:
    Process ID: 2172
    Process name: w3wp.exe
    Account name: CAIDapp_pool

    Request information:
    Request URL: http://intranet/PublishingImages/CA red RGB 78×55.gif
    Request path: /PublishingImages/CA red RGB 78×55.gif
    User host address: 172.16.1.155
    User:
    Is authenticated: False
    Authentication Type:
    Thread account name: CAIDapp_pool

    Looks like with URL Redirector activated, that the users credentials are not getting passed – could this be caused by the absence of UrlMappings.xml?

    Is UrlMappings.xml slow to copy between servers, or is there some other issue preventing that?

    Unfortunately I don't have a multi-server farm to test on, and the production server is too busy for much experimentation.

    • Dev07

       I’ve had a similar issue and resolved it by using an admin account to create arule first, this creates the xml file, and the 403 is no longer a problem for standard users.

      • Bharat

        same issue not working for me on multiple server any update ?

  • http://www.blogger.com/profile/10115476603290489186 dunxd

    Looking more deeply at our Sharepoint setup, I noticed that the web app was extended as part of the migration from Sharepoint 2003. That may explain the problem, as there are multiple inetpub folders relating to the web app.

    You state above that a future release will support this – but from your blog you appear to be focussed on Sharepoint 2010 now. Will there be a new release of URL Redirector for SP 2007? If not, do you have any advice or pointers on where you were going with development to achieve the planned function to deal with extended web apps?

  • http://www.blogger.com/profile/03566878703002667264 Jason Barron

    dunxd – I am planning on releasing an update to both 2007 and 2010. Both would likely include an overhaul to the architecture that would have the rules being stored in a hidden SharePoint List or in the Web Application property bag so that it doesn't have to manage the UrlMappings.xml file on the disk or worry about copying it around to different servers. This should alleviate almost all of the security issues and the issue with extended Web Applications. The only drawback would be that the redirector wouldn't really work outside of SharePoint, but I get the sense that feature is rarely used.

  • Anonymous

    Does the current version of redirector (http://rdacollaboration.codeplex.com/releases/view/28073) works with SharePoint 2010

    Mohid

  • http://www.blogger.com/profile/07319393275431114880 Bharat Gupta

    hello, I have install the solutiona and activate the feature on web applicaiton. I have update settings replaced http://servername/sites1/abc to http://www.abc.com from URLRedirect.aspx page in SharePoint2010. After opening with new URL I am getting windows login prompt but it it not accepting credientials. Please me if I am missing any step.

  • Anonymous

    Appears that you were going to update the solution to work with 2010. Have you done so yet? If so, can it be had?

  • http://www.blogger.com/profile/01672251027627758502 deva

    dear team. greate work..
    servername/sites/sitename/_layouts/layoutfiels.aspx
    not redirecting for a specific site. It is working fine for all the site. If i configure for one site it is not working
    pls help how to set up that..except all working fine.

    Deva.
    Bangalore