404 Header returns 200 OK
Posted: Fri Jan 23, 2009 7:03 am
Hi,
I have spent hours trying to get all this to work with no luck so was after some help.
I have a content based site where I check if the pagename exists and if it doesn't I do the following:
However if I check the response headers I get 200 OK.
That is the first issue.
At the moment I have rewriting turned on so at the moment a url of http://www.domain.com/testpage.html gets rewritten to http://www.domain.com?index.php?page=testpage
If they type something in like http://www.domain.com/pagenotexist.html it will run the above code and return a 404 header.
How can I handle these scenarios?
Thanks
I have spent hours trying to get all this to work with no luck so was after some help.
I have a content based site where I check if the pagename exists and if it doesn't I do the following:
Code: Select all
if (!$pageFound)
{
header("HTTP/1.0 404 Not Found");
}
That is the first issue.
At the moment I have rewriting turned on so at the moment a url of http://www.domain.com/testpage.html gets rewritten to http://www.domain.com?index.php?page=testpage
If they type something in like http://www.domain.com/pagenotexist.html it will run the above code and return a 404 header.
How can I handle these scenarios?
Thanks