1

How to return HTTP header 404 Not found and still show a static html page? I have ErrorDocument 404 mysite.com/searchmysite/index.html in .htaccess. But apparently this is not good for seo.

Similar not answered questions: Can I change the page's HTML status code on the client side? and 404 header - HTTP 1.0 or 1.1?

1 Answers1

1

Assuming you mean to send the 404 error code as part of your own, custom HTML page that doesn't involve ErrorDoccument, you can send the 404 header using Server-Side Code like PHP, for example, using header("HTTP/1.0 404 Not Found");. You must send this before any output, and after sending it, output your custom webpage.

There is also no reason why ErrorDocument would be bad for SEO, unless you are worried about the 404 response, in which case, you do not want to send the 404 header in the first place.

Scott Stevens
  • 2,546
  • 1
  • 20
  • 29