Hi, I have a website that is drivin by a database, the urls are /index.php?id=1 ... I rewrite them to filename.php, this is all great. Now the problem is when someone requests a page that does not exists, I have to check the database to see if the page record is in the database , if not I call ... header('HTTP/1.0 404 NOT FOUND'); echo file_get_contents('404.php'); exit(); PHP: This will display the custom error message page and send the proper headers. Is this the safe thing to do from an seo perspective? edit:If I used header( 'Status: 404' ); I get a 200 responce, but hte status is 404 ... this does not seem better?
Probably better to make it HTTP1.1... but either way it should work fine... header ('HTTP/1.1 404 Not Found'); PHP:
as Shawn said works well Litle tip: use php error page to send yourself a mail thus you don't need to trawl through error logs. Something like this...... if ($HTTP_REFERER <> "") { $today = date("j F Y, G:i:s"); $message = "Date and Time: $today\nRequest URL: http://$SERVER_NAME$REQUEST_URI\nReferring page: $HTTP_REFERER\n\nClient: $HTTP_USER_AGENT\nRemote IP: $REMOTE_ADDR\n\n"; $message .= "This is an automated message.\n\nHave a nice day."; mail(), "Error 404", $message, "From: : errormail<A href="mailto:errormail@mydomain.com");">@mydomain.com"); } Expat