Support » Plugin: 404 to 301 - Redirect, Log and Notify 404 Errors » does not return a 404 HTTP status code

  • I have set up a custom 404 page and have it set to be the destination for all broken links. Unfortunately, though, it does not return a 404 HTTP status code. It returns an 200 HTTP status code.

    Is there any way to correct this in the plugin?
    Or via functions?
    Or via server settings?

    Other than this one issue, I’ve never had a problem with your plugin. It works perfectly.

    Thank you,
    LL

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Leopard-Lady

    (@leopard-lady)

    I’ve found a simple solution to this problem and want to share it with others having the same problem.

    Install the 404page plugin – https://wordpress.org/plugins/404page/

    Follow the instructions to select your custom 404 page, leave the Send an 404 error if the page is accessed directly by its URL setting enabled AND also enable Activate Compatibility Mode — compatibility mode ensures that these 2 plugins work correctly with each other.

    Now your custom 404 page outputs the proper 404 HTTP header status code AND you still have all of the functions of the 404 to 301 plugin.

    I use 404 to 301 because I want to receive immediate notification of 404’s on my sites and have the ability to easily redirect them from the 404 logs. This helps me to control redirects for SEO purposes, alerts me to unintentional 404’s due to errors I’ve made and also makes it easy to add nefarious IP’s to my WordFence firewall blocking rules for tighter security management.

    Thanks for this Leopard Lady.

    I couldn’t believe my eyes when I discovered this 404-301 plugin is sending a 200 response. The whole plugin is pointless if it’s going to do that.

    Looking back through the support threads the author is aware of this but apparently hasn’t done anything about it yet: https://wordpress.org/support/topic/how-to-keep-404-status/

    Plugin Author Joel James

    (@joelcj91)

    Hey @thoughton,

    Yes, I’m aware of this issue. The main purpose of this plugin is to avoid 404 errors. So, we are redirecting those requests to an existing page.

    Since it is requested by many users, I’m already working on this feature. Soon we will be able to set 404 status for the redirects 🙂

    Regards,
    Joel

    Great to hear that Joel, thanks!

    The main issue is that search engines, esp. Bing, see the 200 code and consider the broken/expired URL to be a valid link. So if you unpublish a page it never gets removed from Bing’s index.

    • This reply was modified 2 years, 7 months ago by thoughton.
    Thread Starter Leopard-Lady

    (@leopard-lady)

    Hi Joel – @joelcj91
    This is awesome good news. Thank you for working on a way to implement this.

    As thoughton pointed out, it is troublesome that the 404 header is not fired correctly. And not only from the perspective of search engines indexing non-existant or removed page URLs, but also in regards to external broken link checkers and even broken link check plugins. They’re all looking for the 404 status code.

    You might be interested in another discussion on this matter. Turns out cache plugins play a significant part in this too. I’ve done quite a bit of research on this and posted my findings in the other discussion. I don’t want to overload this discussion by pasting all of the info over here too.

    Here is the other discussion ==> https://wordpress.org/support/topic/404-status-code-changes-to-200-after-first-hit-on-same-url/

    ————

    Hi @thoughton
    It turns out my advice above to use the 404Page plugin in conjunction with this one (404 to 301) is NOT a solution after all.

    2 problems arose:
    1 – Cache plugins serving up the error URL as 200 status
    2 – It very quickly STOPPED this plugin from working correctly

    Apparently, my post above is now too old for me to be able to edit or delete it.

    Please see the link above to the other discussion to better understand the other issues that come into play on this.

    Also, you can use Bing Webmaster Tools to remove your unpublished pages and error URL’s from their index 🙂

    ————

    The more I dig into this issue, the more problems I’m finding in regards to WordPress properly handling 404’s in general. The problem is present in themes and plugins not handling it correctly.

    You’d think by now WordPress would have a better solution for managing 404’s. As it is, WordPress and many themes DO have a 404 template that fires the 404 status correctly. BUT most people are not able to properly set up their desired design and layout on them because it has to be hard-coded. There is no way to handle them in the page editor.

    ————

    Joel – @joelcj91
    Please do let us know when you have this figured out.

    I’d be happy to test it for you too before you release it 🙂

    Thanks guys!!
    LL

    Thanks @leopard-lady I ended up putting this whole mess on hold for a while. The site I’m working on has has messed up 404s for over a year now, another week or two isn’t going to hurt.

    I tried using your solution but had some other major issue with the 404page plugin. From memory the compatibility mode didn’t work with some versions of PHP? I can’t remember exactly. Anyway, it didn’t work.

    Thanks for suggesting Bing Webmaster tools. I’ll have a look. The site in question has thousands of pages so I need some kind of automation.

    • This reply was modified 2 years, 7 months ago by thoughton.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘does not return a 404 HTTP status code’ is closed to new replies.