Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> 404 On A Normal Page
Amezis
post 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
Go to the top of the page
 
+Quote Post
gameratheart
post 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



QUOTE(Amezis @ Sep 9 2006, 08:32 PM) *
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?
Go to the top of the page
 
+Quote Post
Amezis
post 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) */
}
?>
Go to the top of the page
 
+Quote Post
farsiscript
post 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

Go to the top of the page
 
+Quote Post
Spectre
post 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);
Go to the top of the page
 
+Quote Post
electron
post 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
Go to the top of the page
 
+Quote Post
Spectre
post 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.
Go to the top of the page
 
+Quote Post
Amezis
post 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. smile.gif

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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Php Unique Hit Counter(30)
  2. Button To Print Current Web Page(16)
  3. Cpanel Demo Page(46)
  4. Problem With Page Redirect(8)
  5. Google To Take On Geocities(53)
  6. 1000 Cool Web Page Buttons(12)
  7. Communicate With Your Inner Self(7)
  8. Web Page Layouts(7)
  9. How To Make An Item Scroll With You On The Page.(11)
  10. PHP Function To Add Previous and Next Page Feature(5)
  11. Redirecting Visitors To Different Page(8)
  12. How To Implement A Date Picker On A Web Page(0)
  13. Web Page Designing(5)
  14. Weather Cycles Or?(2)
  15. Php Linking(2)
  1. Page Load Error When Trying To Get Into Control Panel(2)
  2. Watching Porn Addiction(21)
  3. Plot Page Help Invisionfree(0)
  4. My Ro Page(4)
  5. Cant Log Into Cpanel [resolved](11)
  6. I Can't Find The Password Reset Page... [resolved](5)
  7. Trap17 Registration Page Linkage Errors(3)
  8. My First Website(14)
  9. How To Change Href Link In Whole Page And All Page In Same Directory(1)
  10. Google We're Sorry Page(5)
  11. Cpanel And Ftp Down, Hosting Up?(7)
  12. Css Page Help(4)
  13. Erroneous Link(1)