[Resolved] Prevent 404 headers from being sent
I have written custom code into my 404.php which attempts to work out what the user was after and show the correct information on the page. From the users point of view no error has occurred and the 404 page is seamless from what they were after, except that 404 headers are still sent = bad.
How do I turn off 404 headers if the code in my 404.php can find what the user was after?
I am also using this technique to effectively allow parameters to be passed to pages, but again 404 headers are being sent.
/pictures/ is a page in my blog.
/pictures/album-name/ is not a page so results in a 404.
.htaccess rules rewrite this behind the scenes to /pictures/?a=album-name
My 404 page triggers and detects the user was after an album so includes page.showalbum.php which reads the album parameter and shows the pictures.
Works perfect except 404 headers are being shown.
For this page I am looking at
isset($HTTP_GET_VARS['a'])if its true then I show the gallery so don’t send 404 headers, otherwise just do a normal 404.
Is there a hook that can be used to tell wp not to send 404 header? I cannot put header(“Status: 200”); in the first line of header.php as it reports that headers have already been sent.
Thanks in advance
- The topic ‘[Resolved] Prevent 404 headers from being sent’ is closed to new replies.