skip to Main Content

Hi I am having an issue of a page loading correctly but with the status code of 404. This is resulting in the page not indexing correctly.

The page is dynamically created which i believe is causing the issue, which is then picked up by yoast seo and declared a 404. I know I can add code in that will prevent this but the 404 status code still remains which will cause the page not to index.

I have tried searching and I can’t find a simple solution to this can anyone help.

2

Answers


  1. You could add to your function file a hook like this :

    add_action( 'wp', 'check_404' );
    

    With a function like this one :

    function check_404(){ if(is_page($your_page_id)){ header("Status: 200"); } }
    

    You could change the is_page() if it’s not a specific page and replace it with other WP functions. I’ve not tested it, but it might fix your issue.

    Login or Signup to reply.
  2. you can say in more detail on the example of this page 404 link

    if in the product category, there are fewer pages over time, for example, from 10 to 4 and then 6, as they are filled with new products

    where the page number is the last two (Slash) and number/9/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search