|
|
|
|
![]() ![]() |
Sep 9 2006, 07:32 PM
Post
#1
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 535 Joined: 14-February 05 From: Oslo, Norway Member No.: 3,759 |
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)?
This post has been edited by Amezis: Sep 9 2006, 07:36 PM |
|
|
|
Sep 9 2006, 09:09 PM
Post
#2
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 511 Joined: 14-November 05 From: Britannia! Member No.: 14,287 myCENT:42.36 |
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? |
|
|
|
Sep 9 2006, 09:34 PM
Post
#3
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 535 Joined: 14-February 05 From: Oslo, Norway Member No.: 3,759 |
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) */ } ?> |
|
|
|
Sep 13 2006, 09:11 PM
Post
#4
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 357 Joined: 8-April 06 Member No.: 21,487 |
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 |
|
|
|
Sep 14 2006, 08:18 AM
Post
#5
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 873 Joined: 30-July 04 Member No.: 246 |
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);
|
|
|
|
Sep 15 2006, 04:19 AM
Post
#6
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 162 Joined: 10-May 06 Member No.: 23,375 myCENT:NEGATIVE[-4.47] |
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 |
|
|
|
Sep 15 2006, 07:51 AM
Post
#7
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 873 Joined: 30-July 04 Member No.: 246 |
He has clarified, in his previous post. He wants scripts to be able to send a 404 Not Found message after processing the request.
|
|
|
|
Sep 15 2006, 03:30 PM
Post
#8
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 535 Joined: 14-February 05 From: Oslo, Norway Member No.: 3,759 |
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. |
|
|
|
![]() ![]() |
Similar Topics