Copied to clipboard

Flag this post as spam?

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


  • Steven Newstead 62 posts 103 karma points
    Feb 07, 2014 @ 10:18
    Steven Newstead
    0

    Regex Redirects

    Hi all,

    I was just wondering if the following is possible:

    I have an old site with a url structure like:

    www.myoldsite.com/here-is-my-microsite

    Which contains a little microsite which needs to redirect to

    www.mynewsite.com/microsites/here-is-my-microsite

    I can get close to doing this with a regex redirect like so:

    Old URL: www.myoldsite.com/here-is-my-microsite(.*)

    This then points to the new "here-is-my-microsite" node in Umbraco

    However this means ALL sub-pages of the microsite redirect to the "here-is-my-microsite" node. Is there anyway to preserve the URL from the old url so the sub-pages redirect to the correct location?

    What I mean by this is if I have the following old page

    www.myoldsite.com/here-is-my-microsite/here-is-my-microsite/page-1

    I'd like to redirect it to 

    www.mynewsite.com/microsites/here-is-my-microsite/page-1

    But without setting up redirects page by page.

    Or is this more of a job for IIS redirects?

     

  • Stefan Kip 1578 posts 4013 karma points c-trib
    Feb 07, 2014 @ 10:20
    Stefan Kip
    100

    Yes, since v2.2.2 this is possible:

    [Feature] Added regex capturing groups support (use '$n', where n is the capturing group number starting from 1)

    So the redirect should be done to a URL, something like '/microsites/here-is-my-microsite$1'

  • Steven Newstead 62 posts 103 karma points
    Feb 07, 2014 @ 10:45
    Steven Newstead
    0

    You beautiful man, that works!

  • Arie 224 posts 675 karma points
    May 25, 2014 @ 01:47
    Arie
    0

    This doesn't appear to work in my install.

    Umbraco 6.2.0

    URL Tracker 2.5.3

Please Sign in or register to post replies

Write your reply to:

Draft