redirect regex rule

#777466
  • Resolved Alireza
    Rank Math free

    I’d like to redirect my old slugs (of the format: ‘string’-‘digits’) to new ones (of the format ‘string’-r-‘digits’). I tried the below regex rule but it doesn’t work.
    Source url: product/(bw+-w+)-(d+b)
    Destination url: product/’$1-r-$2′

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    I apologize for the issue you are facing with the regex rule for redirecting your old slugs to new ones. The regex rule you provided seems to have a small error that might be causing the problem.

    To redirect old slugs of the format ‘string’-‘digits’ to new ones of the format ‘string’-r-‘digits’, you can use the following corrected regex rule:

    • Source URL: product/(bw+-w+)-(d+b)
    • Destination URL: product/$1-r-$2

    Please make sure to add this corrected regex rule in the appropriate fields in Rank Math’s redirect manager. If you encounter any further issues or need additional assistance, please feel free to reach out to our support team.

    Thank you for bringing this to our attention, and we appreciate your patience as we work to resolve this matter for you.

    Sources:
    How to Use Regex Redirects in Rank Math » Rank Math
    How to Redirect Posts After Changing URLs » Rank Math
    How to Use Regex Redirects in Rank Math » Rank Math
    Redirect all AMP pages to non-AMP pages » Rank Math
    How to Use Regex Redirects in Rank Math » Rank Math

    Alireza
    Rank Math free

    I tried your solution and it didn’t work.

    Hello,

    Thank you for your patience.

    Could you please share an exact example URL you’re trying to redirect and the URL where it should be redirected?

    Meanwhile, you can try this format and let us know if it achieves the redirection you’re referring to:

    Source: product/(.*)-(.*)
    Type: Regex
    Destination: product/$1-r-$2

    Looking forward to helping you.

    Alireza
    Rank Math free

    I tried your solution and it didn’t work. I’ll add an example of source and destination urls in the sensitive data section.

    Hello,

    Please try to use the following regex redirection on your website and see if that works for you:

    Source: product/([a-zA-Z0-9-]+[^-r])-([0-9]+)
    Match: regex
    Destination: /product/$1-r-$2/
    

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Alireza
    Rank Math free

    Still not working.

    Hello,

    In this case, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.

    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    Looking forward to helping you.

    Thank you.

    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 7 replies - 1 through 7 (of 7 total)

The ticket ‘redirect regex rule’ is closed to new replies.