View Single Post
Old 02-21-2010, 03:45 PM   PM User | #1
tomrshl
New Coder

 
Join Date: Aug 2009
Posts: 31
Thanks: 3
Thanked 0 Times in 0 Posts
tomrshl is an unknown quantity at this point
Return 404 on mistyped url variables

I've been trying to figure out PHP and 404 errors.

If somebody types
Code:
http://site.com/?id=valid
I want my PHP to deliver the content.

If they type
Code:
http://site.com/?id=invalid
I want to return a 404 error and then after a couple of seconds return to the homepage.

I tried:
Code:
header("HTTP/1.0 404 Not Found");
But according to Live HTTP headers add-on in Firefox, it loads
Code:
HTTP/1.1 200 OK
first.

How can properly I deliver a 404?

Thanks a lot
tomrshl is offline   Reply With Quote