404 Monitor to Catch All page if not matched

  • Hello!

    I’m working on a full relaunch of my website. It’a a clean built, but I want to keep some of my top ranked articles.

    I used a comprehensive plugin to export exactly what I wanted, and have imported that into the new site.

    1. I kept the permalink structure from the old site.
    2. I changed, updated, and removed some article categories.
    3. I then wanted to simplify and change the permalink structure in WP

    Before I did this, I installed RankMat to monitor URL changes.

    It seems that when I’m now trying to access the old URL from the old site, it’s redirecting nicely to the new URL structure on the new site.

    But what about articles I didn’t include and should go to a custom 404 page I have set up?

    Doesn’t RankMath have a settting for that under Redirections > Custom Redirection?

    When I turn that on, all the URL rewrites go to this page, even if they exist.

    -John Mac

    • This topic was modified 5 months, 1 week ago by JohnMac.pro. Reason: Adding login info
Viewing 15 replies - 1 through 15 (of 20 total)
  • Hello,

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

    Could you enable the Debug mode and show us the log it generates? You can add it to the Sensitive Data.

    I have attached a screenshot so you know what I mean when I say enable the Debug Mode: https://i.rankmath.com/MyPcLF

    Looking forward to helping you. Thank you.



    Thanks for the quick follow-up. I have enabled debugging now.

    Hello John,

    Could you please turn the debug redirections option on? You can do it from WordPress Dashboard > Rank Math > General Settings > Redirections.

    Then, you will know why a particular URL is being redirected to the fallback URL.

    If that doesn’t work, we might need to take a closer look at the settings. Please 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:

    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):

    We really look forward to helping you.


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

    Thank you.

    Okay, I have added link to my new site + login info.

    This URL is the new built for my site on a sub-domain. You can go to one of my homepage articles on the www. version and copy the URL of one of the homepage articles.

    Then load that URL with the 2020. prefix and test. The article is on my new site and will load fine if I leave RankMath settings on Default 404.

    But then, how do you set up a catch-all custom 404 page when one of the OLD excluded articles is not found?

    Hi John,

    Thanks for the reply.

    Everything seems to be working as expected. Copying one of the old links to the new site is redirected to the configured 404 page : https://2020.domain-name.com/not-found/

    This page will then be catching all the 404 pages on the new site. You can also set this to another custom page that you would like to be the destination of the 404s.

    We are looking forward to helping you. Thank you.

    Hey Michael.

    Yes I know that page works fine. But that’s not what I want for all my existing articles of course!

    Copying and opening to link from the old site is supposed to find the new URL for the article, isn’t that right? If you saw what I wrote in my previous posts. I want to make sure RankMath can relocate my articles with the new URL structure.

    IF one of the articles on the new site have been removed (I remove some old articles in the new site) -THAT should redirect to a catch all page.


    Please check the screencast I shared.

    It shows that the fallback is working for 404s.

    Please note that this will work only for the current domain.

    It doesn’t work for www version or any other domain that is not set as your URL in WP > Settings > General.

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


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

    Thank you.

    Okay, seems like you’re not getting my questions. So I have probably been unclear. I just added a Loom video so you can see what I mean.

    Thanks again,


    Hi John,

    I think I got it.

    When you enable the Fallback option, your Old site structure’s URL are not getting redirected.

    It seems like in your case, the 404 is triggered before the 301 can be triggered. That is why you are seeing the error you are seeing.

    To fix this, I would recommend you go to the old website (the www one).

    Setup a redirect like this:

    Type: regex
    Source: /(*)
    Target: https://2020.moXXXX-XXXXXt.com/$1

    Then on the new site, you would want to place another regex to redirect the links that have the category name to the URL without the category name.

    Type: regex
    Source: /sample-category/(*)
    Target: $2

    This should ideally work like this:
    Old URL > New subdomain with the same URL Structure > When that is not found, trigger the 301 in new domain to the correct URL structure.

    If you would like me to set it up for you, please share the details of the previous website as well so I can add it.

    If I find any issues, I will let you know.

    Thank you.


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

    Thank you.

    I added a second reply here to make sure I get this right. If I don’t I need to find a second plugin to handle 404 catch-all and a 410 response on them.

    That is a fallback for current redirects. It does not mean your 404s will be automatically redirected. It just means that if you setup a redirect using Rank Math and the target of that redirection turns out to be a 404 – Rank Math will fallback to the settings you selected in that screencast you shared.

    Here is how it works:
    You redirect Link A to Link Z.
    You redirect Link B to Link Z.

    But, if Link Z doesn’t exist on your website or it shows a 404, Link A and Link B will be redirected to your fallback URL.

    Let me know if that makes it a bit more clear.

    Okay, then I get it. Thanks.

    So what, then, is making the redirect for the new URL structure work on the site now?

    If I copy a link from the old site like I showed you and paste it into the new site (switching out www for 2020.) my article is found.

    Is that a native WP function?

Viewing 15 replies - 1 through 15 (of 20 total)

You must be logged in to reply to this ticket.