Help needed with RegEx redirections not working

#108033
  • Resolved Web Geek
    Rank Math free

    Hi! I’m experiencing an issue where RegEx redirections aren’t working. I had one written like this:

    Source: /some-text-goes-here/
    Destination: /{URL of my site}/

    When I visited the URL to redirect, I get a 404 “not found” page instead. So, I tested my source expression and found it was incorrect. Since I didn’t “escape” the forward slashes, the expression was “bad”. So, I added escapes to the forward slashes and my expression started working in online RegEx test sites, like regex101.com. However, the redirection still didn’t work.

    So this is my question: where can I find documentation on the RegEx syntax the RankMath Redirection Manager expects for RegEx redirection expressions? I’ve seen other support tickets where the corrected RegEx syntax, for a given expression, was provided but there was no reference to a “syntax guide” of sorts. Are PCRE expressions expected vs JavaScript expressions?

    I resolved my immediate issue by changing from “RegEx” to “Contains” and now the redirection works as expected.

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Michael Davis
    Rank Math pro

    Hello,

    Thank you for getting in touch and I am extremely sorry about the trouble this might have caused.

    Here are some detailed articles on using the Regex expressions:

    https://www.regular-expressions.info/tutorial.html
    https://redirection.me/support/redirect-regular-expressions/

    Even if you’re careful while using Regex, mistakes can happen. You can test your regular expressions with this online editor before you use them live on your site: https://regex101.com

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Help needed with RegEx redirections not working’ is closed to new replies.