Redirecting old permalink structure to new

#88263
  • Resolved efnweb
    Rank Math free

    Hello,

    We are test-driving RankMath as an alternate to Yoast SEO Pro. Though I have found forum posts that parallel our question, I have not been able to apply the suggested solutions to our scenario for a successful resolution. Also in the knowledgebase I came up empty. Hoping for a little help here.

    We want to change our site’s custom permalink structure from: /blog/%year%/%monthnum%/%day%/%postname%/ to: /%postname%/ and redirect requests for posts under the old permalink structure to the new.

    Is there a regex redirect that can help us with this in RankMath? We have quite a few posts, so manually redirecting each would be quite labor intensive.

    Appreciative for any tips.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Alberto
    Rank Math business

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    You could try this regex as source:
    \/(blog)\/([0-9]*)\/([0-9]*)\/([0-9]*)\/(.*)\/
    And this as target:
    https://yourwebsiteurl.com/$5

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Hello Alberto,

    Thanks for the tip. Unfortunately, it did not work. Of course, there were no issues internally on the site, but accessing pages from Google search hits still result in 404 errors when we change the Permalink rules and use redirect you suggested.

    We would sure appreciate additional tips if you have any.

    Hello,

    Could you please share a sample URL of the posts you are trying to redirect so we can test and check this from our end.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Thank you. Yes, it’s primarily the posts in the site’s blog: https://www.benefitscafe.com/blog/ (News -> Blog on the menu).

    As an example of what we want (AFTER we change the permalink structure in WP Settings) is for searches in Google to 301-redirect from the old structure to the new. For instance:

    OLD STRUCTURE
    /blog/%year%/%monthnum%/%day%/%postname%/
    https://www.benefitscafe.com/blog/2020/06/11/medical-insurance-premiums-after-covid-19/

    NEW STRUCTURE
    /%postname%/
    https://www.benefitscafe.com/medical-insurance-premiums-after-covid-19/

    The goal is to avoid search engines returning 404 errors and deteriorating our SEO.

    Appreciate the ongoing help.

    Alberto
    Rank Math business

    Hello,

    If you want, we could take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    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/

    We really look forward to helping you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    I created and tested the following redirection on your site and it works perfectly.

    Source: blog/\d{4}/\d{2}/\d{2}/(.*)

    Destination URL: https://www.benefitscafe.com/$1

    I have currently reverted to your original settings and deactivated the redirection on your site, feel free to activate it and change your permalink settings when you wish to.

    Please ensure to clear your cache when you activate and change the settings.

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

    Yes, very nice. Thank you for sticking this out with us. Inbound referrals for the old permalink structure now 301 redirect to the new.

    In case it’s helpful for others dealing with the same issue, one thing we didn’t try (and probably should have) was removing the starting forward slash in the reg-ex redirect, i.e.: we had “/blog/” = “\/blog/…” in reg-ex, but in the functioning script “/blog/” translates to “blog/”. In any case, thanks for the patient help. I’ll mark this as resolved.

    • This reply was modified 3 years, 11 months ago by efnweb. Reason: Mark as resolved

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)

The ticket ‘Redirecting old permalink structure to new’ is closed to new replies.