Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 26, 2012 @ 23:39
    Bo Damgaard Mortensen
    0

    Major 301 redirects/url rewriting

    Hi all,

    I'm about to build a rather large website from scratch on Umbraco (of course, duh'!) and I have just received a document from the client with nothing less than over 1600 URLs from the old site that needs to be 301 redirected on the new site.

    Also, the client wants to be able to create these redirects themselves from Umbraco.

    I've looking into the ever awesome package, 301 Redirect Tracker which suits the needs perfectly. There's just one major caveat to this: nearly all of the old urls are .html and .php which the package doesn't seem to be able to handle :-(

    Has anyone found a way to make it handle these extensions aswell as .aspx?

    I'd also like to hear your experience with this subject since I can only image that this won't be the last time I'm running into this situation.

    Any help/hint is greatly appreciated!

    Thanks in advance.

    Bo

  • Paul Blair 466 posts 731 karma points
    Apr 27, 2012 @ 01:25
    Paul Blair
    0

    depending on your setup it might be possible to make a couple regex that wil cover most of the cases e.g.

     

    <add name="redirHTML"

             virtualUrl="(.*)://www.site.com/(*).html"

             rewriteUrlParameter="IncludeQueryStringForRewrite"

             destinationUrl="$1://www.site.com/$2"

             ignoreCase="true"

             redirect="Domain"

             redirectMode="Permanent" />

     

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 27, 2012 @ 09:11
    Bo Damgaard Mortensen
    0

    Hi Paul,

    Thanks a lot for your input :-)

    I've tried your regex, but I'm getting the following error:

    parsing "(.*)://umbtestsite.local/(*).html" - Quantifier {x,y} following nothing.

    I've tried with the following url rewrite:

    <add name="redirHTMLLvl1"

                    virtualUrl="(.*)://umbtestsite.local/(*).html"

                    rewriteUrlParameter="IncludeQueryStringForRewrite"

                    destinationUrl="$1://umbtestsite.local/$2"

                    ignoreCase="true"

                    redirect="Domain"

                    redirectMode="Permanent" />

    Admittedly I'm not the strongest when it comes to regex ;-) 

    Also, is it possible to make it go deeper? Som urls are like this: /page1/page2/page3/page4.html and som even deeper than that.

    Thanks again!

    - Bo

     

  • Paul Blair 466 posts 731 karma points
    Apr 29, 2012 @ 22:47
    Paul Blair
    0

    Yes, regex isn't my strong point either. In this case it looks like I've missed out the dot from the 2 nd expression; should be "(.*)"

    To make it go deeper is possible e.g. you could make a rule for /page1/page2/page3/page4.html to go to /products/page4. I suggest you google some online regex tools so you can test and develop the regex if you're going to do this as it will be reasonably hard to test toherwise.

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    May 03, 2012 @ 15:30
    Tim
    0

    For working with RegEx, I highly recommend Expresso, it's free, and has a RegEx builder tool, and workbench to allow you to test out your RegExs. I've been using it for years, it's great.

    :)

Please Sign in or register to post replies

Write your reply to:

Draft