Amezis 0 Report post Posted September 9, 2006 (edited) Well, I am using a mod_rewrite script, making "http://forums.xisto.com/no_longer_exists/; a valid page even if it shows that the page could not be found. How can I add to the header with PHP that the page is not found, replacing the 200 status code (OK)? Edited September 9, 2006 by Amezis (see edit history) Share this post Link to post Share on other sites
gameratheart 0 Report post Posted September 9, 2006 Well, I am using a mod_rewrite script, making "http://forums.xisto.com/no_longer_exists/; a valid page even if it shows that the page could not be found. How can I add to the header with PHP that the page is not found, replacing the 200 status code (OK)?I am not too sure what you mean here. Do you mean that you want to make it so that if a 404 appears on your website, it still thinks the page exists? Share this post Link to post Share on other sites
Amezis 0 Report post Posted September 9, 2006 No: <?phpif ( page_exists ){ // Do all normal stuff}else{ /* Page doesn't exist, send a 404 error status in the header instead of the 200 status, and give the user a friendly 404 error page (I do not wish to use a redirect) */}?> Share this post Link to post Share on other sites
farsiscript 0 Report post Posted September 13, 2006 Dear Amezis You can customize erre page in cpanel You can manage HTML code and then copy soruce of your design and save fileerre pages save as shtml files Share this post Link to post Share on other sites
Spectre 0 Report post Posted September 14, 2006 But that's not what he wants to do.Simply use the header() function within a script to overwrite the original status and send a 404 message: header('HTTP/1.1 404 Not Found',true); Share this post Link to post Share on other sites
electron 0 Report post Posted September 15, 2006 Hey what do you want to do ?Do you want to use mod_rewrite in apache and make a not found page having the URL http://forums.xisto.com/no_longer_exists/Or do you want to send a header that the page wasnt found.Please Clearify Share this post Link to post Share on other sites
Spectre 0 Report post Posted September 15, 2006 He has clarified, in his previous post. He wants scripts to be able to send a 404 Not Found message after processing the request. Share this post Link to post Share on other sites
Amezis 0 Report post Posted September 15, 2006 Thanks Spectre. :)For those who didn't understand my question, I have a php file. If someone loads file.php?view=this_exists, everything is done normally. But if someone loads file.php?view=this_doesnt_exist, then the 404 error code is shown. I am using mod_rewrite, so file.php?view=this_exists is displayed as /this_exists.A search engine would not understand that /this_doesnt_exist doesn't exist unless the 404 header was sent. So I simply wanted to send a 404 in the header without using the apache error function since that wouldn't do the job. Share this post Link to post Share on other sites