I am working on a site that shows content for cities, neighborhoods, zip codes, etc.

User can type http://example.com/miami or http://example.com/33101.

Each page is created dynamically.

My site does not have a static page for miami.

When user types http://example.com/miami the server thinks it is a 404 and executes my 404.php.

In the 404.php I capture the word after the website url (miami, 33101, etc) and then I show the relevant content.

From a user experience perspective, the user does not know that the server thought it was a 404 error.

I am now concerned with SEO.

My site has links to my target locations. For example, in the homepage I have links to the top 10 destinations.

When the search engines crawl my site, they will find the links to those destinations. When they go to those links, I believe the server will return the 404 header. Even though the 404 page will have relevant, rich content, I believe the search engines will think it was a broken link and penalize the site.

Am I thinking about this the right away?

Should I stop using the 404 page to show content and find another way to (redirecting?) to show the dynamic content?



I am overriding the 404 header with a 200 header. When I inspect the headers it shows 200 OK.

Does it mean I can continue to use the 404 page to display my content, or there is another way the robots can tell it was a 404 page?


  • 2
    What status code doors your script return. If you override the status to return '200 OK' then it is no longer a 404 error. Mar 25, 2019 at 18:57
  • @StephenOstermiller I am changing the header to return 200 OK. I inspected the headers and it seems to be working. Is that all I need to do?
    – jdias
    Mar 25, 2019 at 20:38
  • Users and search engines can only judge your site by the output it produces. The server side code is irrelevant as long it produces the correct output. Mar 25, 2019 at 20:41

1 Answer 1


If the page shows a 404 header code, regardless of the content, the search engines will drop the page from their index.

What you need to do is overwrite the 404 responde code with a 200, but only for those pages that actually deliver a result. If you start pushing 200 codes for pages with no or thin content, the search engines will penalize you in the long run.

Also as per your example, if both of these addresses return the same content, you'll get penalized from being duplicates:

If that happens to be the case, you should also use a canonical tag to tell the search engines which is the main page, and which is just an alias.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.