« Previous Next »

Thread: Setup multiple rewrite rules

Last post 04-25-2009 1:01 PM by sharepointbuzz. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 04-24-2009, 3:23 PM

    Setup multiple rewrite rules

    I am having issues where just the rewrite maps are working for me but not the rewrite rules. 

    i just recently migrated my blog from wordpress over to sharepoint.  while running my wordpress blog, i have changed the url structure a few times.  i have had to setup multiple rules for each of the different urls so that hopefully the url rewrite module will work for all types of urls that are coming in.  i need the communities help in understanding what im doing wrong.

    here are my requirements:

    1. 301 redirect - to ensure that SEO rankings are passed over to the new URL structure
    2. need to process all the rules and make sure users see the new URL structure

    here are the 4 rules i have setup:

    1. rewrite map
      • reason:  this rule is used for URLs that can not be matched from the old URL structure to the new URL structure
      • stop processing: true
      • match url: .*
      • condition: match ll -> StaticRewrite matches pattern (.+)
      • action: redirect, {C:1}, Permanent (301)
    2. date / text redirect
    3. date / text / feed redirect
    4. index.php / date/ text redirect

    now the first rule works great but since i want permanent 301 redirects, the option to uncheck stop processing all rules is not available for me.  the option to uncheck stop processing all rules is only available if i select the rewrite option - which is not what i want. 

    my traffic has obviously dropped off by 2/3.  i would love it if someone can help me achieve my requirements of permanent 301 redirect the following different urls:

    to the following new url structure

     

    appreciate any advice you can all give me.  i hope this explains my issue appropriately.

    http://www.sharepointbuzz.com
  • 04-24-2009, 4:42 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 660

    Re: Setup multiple rewrite rules

    The patterns in the rules do not match the url's because all patterns start with "^/" (i.e. they require a slash at the beginning). The URL path that is used for matching agains the pattern, does not contain the slash at the beginning.

    Regarding the stop processing flag - when rule action is redirect, custom response or abort request, then none of the subsequent rules will be executed, regardless whether you have stop processing checked or unchecked.

    I think you can express all this redirect logic with two rules:

    Rule 1: Your existing rule with rewrite map.

    Rule 2: The redirect rule with the following parameters:

    Pattern: ^(?:index\.php/)?(\d{4})/(\d{2})/(\d{2})/([_\d\w-]+)(?:/feed/?)?

    condition: none

    action: redirect, archive/{R:1}/{R:2}/{R:3}/{R:4}.aspx, Permanent.

    http://ruslany.net
  • 04-25-2009, 1:01 PM In reply to

    Re: Setup multiple rewrite rules

    that seemed to have worked like a charm ... thank you.   a few things i wanted to ask

    1. how can i 301 redirect /blog/category/some-name/ OR /blog/tag/some-name/ to /archive/tag/some-name/
    2. i do notice that some times the redirect do not work... it seems the IE keeps trying and keeps cycling but never returns a 404 or goes to the correct page. restarting IE or launching old URL in FF will redirect to new URL - any suggestions on performance?
    http://www.sharepointbuzz.com
Page 1 of 1 (3 items)
Microsoft Communities