goodespeler Posted April 1, 2008 Share Posted April 1, 2008 if (!file_exists($this->section.'/includes/head/'.$this->page.'_head.php')) { header("HTTP/1.0 404 Not Found"); header("Location: http://".$this->domain."/404/"); } I'm trying to do a 404, but I don't think this is the proper way since once the redirect happens, the 404 header goes away. Any thoughts on how to do a proper 404? Link to comment https://forums.phpfreaks.com/topic/98982-doing-a-proper-404/ Share on other sites More sharing options...
uniflare Posted April 1, 2008 Share Posted April 1, 2008 why do u need a redirect? just include the script instead. why do you want to send that header? can you not just say "Page cannot be found"? are you using the default 404 error pages from apache? thanks, Link to comment https://forums.phpfreaks.com/topic/98982-doing-a-proper-404/#findComment-506479 Share on other sites More sharing options...
goodespeler Posted April 1, 2008 Author Share Posted April 1, 2008 I can't just include the script since it's an entire page. Here's what I'm doing. I have my site setup to rewrite the url like this http://domain.com/section/page I'm trying to make it so that if I can't find the $page (/page), give the user a 404. If I just included the 404 page, I'd be including a page within a page. Link to comment https://forums.phpfreaks.com/topic/98982-doing-a-proper-404/#findComment-506539 Share on other sites More sharing options...
uniflare Posted April 1, 2008 Share Posted April 1, 2008 OK . i get ya, just add the 404 header to the start of the next script you are redirecting to? i have always used the 404 apache error document to redirect to a 404 error page on my website Link to comment https://forums.phpfreaks.com/topic/98982-doing-a-proper-404/#findComment-506544 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.