• Resolved shreen2008

    (@shreen2008)


    Hello.

    I have an old permalink structure of /%category%/%postname%.html

    The new permalink structure is /%postname%/

    What is the regex code for this redirection in the Redirections module.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @shreen2008,

    Thank you for contacting support.

    It’s not possible to create a single Regex expression for this because it depends on the name of the category.

    So you would need to add one Regex like so for the HTML extension removal:

    Source: (.*).html
    Destination: https://yourdomain.com/$1

    And then use one for each category of the website like so:

    Source: /category-name/(.*)
    Destination: https://yourdomain.com/$1

    Hope this helps clarify your doubts.

    Don’t hesitate to get in touch if you have any other questions.

    Thread Starter shreen2008

    (@shreen2008)

    Thanks for the update.

    What if the redirection is /%category%/%postname%.html to /%postname%.html

    Will there be a common regular expression for it or do I need to do it for each category as the above.

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @shreen2008,

    Unfortunately, you may need to create a regex for each of your categories as mentioned above.

    Since there’s no rule to detect that the characters/words are from categories in regex redirects, then you should create one for each of them.

    Also, we do not recommend changing the URL structure on websites where traffic comes and the pages are indexed because URLs do not impact the rankings. It is just a convenience for the readers.

    You can read more about redirections on our website here:
    https://rankmath.com/kb/wordpress-permalinks/

    Hope that helps.

    Thread Starter shreen2008

    (@shreen2008)

    Hello.

    Thanks for the update. But I have a new problem.

    I typically have issues like this.

    1. /?amp
    2. ?nonamp=1
    3. /amp/

    I want to redirect these pages to the normal webpage.

    For eg.

    https://www.thinkminds.co.uk/idrive-vs-google-drive-vs-onedrive/?nonamp=1

    should redirect to

    https://www.thinkminds.co.uk/idrive-vs-google-drive-vs-onedrive/

    This is because I removed the AMP plugin and no longer using AMP pages.

    How to do it on Rank Math Redirections module. ??

    Please help me.

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @shreen2008,

    We have a dedicated KB for redirecting AMP pages. Hence, we’d suggest you to read the complete guide to learn how you can resolve this one:
    https://rankmath.com/kb/redirect-all-amp-pages-to-non-amp-pages/

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

    Thank you.

    Thread Starter shreen2008

    (@shreen2008)

    Hi.

    It only gives answer to one type of amp redirection.

    But for other AMP urls I didnt find any regex code.

    Could you please give the right code for all the 3 types mentioned above.

    Please help as I have lot of errors in search console.

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @shreen2008,

    As mentioned in the KB shared above, it’s not necessary to redirect the query parameter ?amp or ?nonamp=1.

    When a visitor lands on these pages, the query parameter will be ignored, and the browser will load the canonical non-amp page for your visitor. In this case, no 404 error will be captured, and you need not worry about duplicate content issues since the page points out the canonical URL.

    The only redirection you need is to redirect the URLs with /amp/ at the end. And the regex rule is provided for that in the KB:
    https://rankmath.com/kb/redirect-all-amp-pages-to-non-amp-pages/#num-3-create-a-regex-redirection

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

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Regex required’ is closed to new replies.