Some of web pages are actually contained in my database. I have the htaccess with the following
ErrorDocument 404 /error404.php
My error404 do a require("checkdb.php");
which check if the filename is represented in MySQL db. If so, I want to return 200 OK and spit out the content.
If not, I want to spit out that 404
My problem is I'm stuck with 404. While my page is properly displayed, it won't get picked up by search engine and the google+ doesn't work has it does a check for the page and it gets 404.
I've added
header('HTTP/1.1 200 OK');
right after a check in the database (no html code has been displayed yet), but I get the
Warning. Cannot modify header information - headers already sent by ....
Even if I move that header()
right at the beginning of /error404.php
I still get that error. It sounds like Apache will return that 404 first and then call /error404.php
What can I do to properly fix this? Thanks very much in advance!