Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Darin Kotter

    (@dkotter)

    Yes, this can be accomplished in two different ways. Safe Redirect Manager supports regex, so you can turn that on and have matching patterns you can use.

    But an even simpler approach is to use the * wildcard character, which can be used both in the Redirect From and Redirect To fields.

    For your example, you could set a Redirect From value of /author/*/ and a Redirect To value of /person/* and this should redirect https://mysite.com/author/someauthor to https://mysite.com/person/someauthor

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Thanks. That works. I should have realised this myself.

    That said, can you point me to an example of a redirect rule using regular expressions, where matching terms in the ‘from’ are used in the ‘to’?

    Plugin Support Darin Kotter

    (@dkotter)

    So for the same example, if you turn on the Enable Regular Expressions option, you should be able to use

    \/author\/(.+)\/* in the Redirect From field

    And then in the Redirect To field, you should be able to use /person/$1/

    This will capture any URL that is in the format of /author/string or /author/string/ and redirect it to /person/string/ . You can also make the regex more strict if you know exactly what needs to be matched. In this example, it matches basically all characters but you could limit that to just lower case letters for instance if that’s all you care about.

    Thread Starter Babak Fakhamzadeh

    (@mastababa)

    Awesome. Many thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Redirect on matched string, replacing the string?’ is closed to new replies.