My legacy URLs have this structure:

/teachings/tag/13721/omnipotent/ or /teachings/series/17764/fearless/

For both the tag and the series they are always followed by a string of digits and then slug I want to capture and redirect to the new formats:

/teachings/topics/omnipotent and /teachings/series/fearless

I've tried various ways using https://regexr.com/ to capture the slug and target each legacy URL but I can't seem to figure it out. I've seen the basic instructions here but I can't seem to find a way to target the unique legacy formats of these strings.

Any help you can provide would be greatly appreciated.

  • My legacy URLs have this structure: /news?id=beechbrook-capital-provide-follow-on-capital-to-the-bhsl-group-to-facilitate-growth-&s=0.446550675146 and i want: /news/beechbrook-capital-provide-follow-on-capital-to-the-bhsl-group-to-facilitate-growth i want to remove -&s=0.444455.. please help Jun 3 at 13:33

1 Answer 1


Here's the regex I think you'll need:

  1. \/teachings\/tag\/\d+\/(\w+)\/?\/teachings\/topics\/$1
  2. \/teachings\/series\/\d+\/(\w+)\/?\/teachings\/series\/$1

A couple explanations:

  • \/ is an escaped / character
  • \d+ means one or more digit (0-9)
  • \w+ means one or more alphanumeric/underscore character (A-Z, a-z, 0-9, _)
  • surrounding something in parentheses makes it a capturing group, which can then be referenced when you're doing the "replace"

So in our regex we're matching the current url structures, capturing the slug, and then using that in the new url structures. Hopefully that helps!

  • This worked perfectly! With the way retour handles the Destination URL filed the escaped sequences generated //teachings//topics.... I shortened the Destination URL portions to /teachings/topics/$1, etc. and it worked perfectly. Aug 30, 2019 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.