| | Well, I am using a mod_rewrite script, making "http://www.mysite.com/notfound/" 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)? |
|
|
Well, I am using a mod_rewrite script, making "http://www.mysite.com/notfound/" 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?
No:
CODE <?php if ( 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) */ } ?>
Dear Amezis You can customize erre page in cpanel You can manage HTML code and then copy soruce of your design and save file
erre pages save as shtml files
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: CODE header('HTTP/1.1 404 Not Found',true);
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://www.mysite.com/notfound/ Or do you want to send a header that the page wasnt found. Please Clearify
He has clarified, in his previous post. He wants scripts to be able to send a 404 Not Found message after processing the request.
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.
Recent Queries:-
Keywords : 404 normal
|
|
![]() 404 On A Normal Page |
| ADD REPLY / Got an Opinion! | a humble request :-) | RAPID SEARCH! | Free Hosting | [X] |
|
Express your Opinions, Thoughts or Contribute your information that might help someone here. Ask your Doubts & Queries to get answers.. "Together, We enlight each other!" |
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP. | 500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE |
|