[Resolved] How do I return the correct HTTP status code for a 404 error page?

Home Forums Support [Resolved] How do I return the correct HTTP status code for a 404 error page?

Home Forums Support How do I return the correct HTTP status code for a 404 error page?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1664251
    Yurik

    Hi,

    for some reason (I can’t find why and how to enable), on my website any time if I’m trying to access no existing pages/urls – it just redirects to the main page and gives the Status code 200 instead 404.

    Please can you help and advice how I should configure WordPress and Template to return the correct HTTP status code (404) and display the 404 page (Oops! That page can’t be found)?

    Many thanks
    Bets Regards

    #1664359
    David
    Staff
    Customer Support

    Hi there,

    that should be the default behaviour.
    Things to check for:

    Server config – for example HTTAccess.
    Cache Plugins – that may be affecting the 404 return.
    Redirect plugins or scripts.

    #1665921
    Yurik

    Hi David,

    Thanks for reply!

    Server config – for example HTTAccess.- Checked and asked hosting provider to review. There is nothing unusual and all looks correct

    Redirect plugins or scripts. – Never used or added any of these. Should not be a matter in this case

    Cache Plugins – that may be affecting the 404 return. – Recently swap to WP Rocket, therefore I can presume that this plugin could cause this problem, but I’ve tried to switch it off, and it still redirects to main page within status code 200.

    I understand that this is nothing to do with the theme, but please could you give me some advice how I should action?

    Many thanks
    Best regards

    #1666008
    Yurik

    Hi David,

    I found the problem! This time it was the SEO plugin, where it was set up (default), redirection to main page, and so gives the Status code 200 instead 404.

    By modifying this, now it redirects to 404 page and gives the correct status code 404.

    Amen!)

    Best Regards

    #1666340
    David
    Staff
    Customer Support

    Glad to hear you found the issue!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.