I’m trying to get my 404 document to check the DB to generate a page if the URL provided is listed there, but the server seems to send out a 404 header before I get a chance (in the 404 script) to send a 200 (if there is a matching page reference in the database – how can I prevent this?
Everything is routed through the index.php or default.php, correct?
I recommend creating a static 404 page rather having than a database driven one. Then, when you send the 404 header it’ll just show the custom error page. You just need to edit your httpd.conf file to set the new 404 page
I’m not sure I have acces to the httpd.conf as this project is on shared hosting, even the the.htaccess is locked down to a few ‘allowed’ options.
If I change to a static 404 page, how will I get the server to execute the index.php (in the webroot?) that will generate the page if the client requested URI is http://www.examplesite.com/exampleproduct/index.php (which, of course, won’t actually exist?)
to execute the error script in the event a requested file or folder could not be found. The benefit of this being that no header is sent and you can then decide in that script which header you want to send and what to display (based on page info you might have in the DB etc.)