|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
As a follow up on this, I've just created a basic html page with just the following at the top of the page
Code:
<?php
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
?>
Could it be that the htaccess url rewriting that the site uses is affecting the 404 reponse? |
|
||||
|
The problem with your first attempt is that the code you are using to determine whether or not to return a 404 error is executing after your PHP parser has already sent output to the browser.
The problem with your second test very likely has something to do with your host's setup (they may be including some code or output which is being sent to the browser before your script runs). You can contact your host about this - if they can't help you, I would recommend moving to the other host you tried (i.e. a host which is not doing anything "behind the scenes").
__________________
Dan LeFree | Product Manager (Linux VPS Hosting) | Owner/Operator (Web development, marketing) |
|
|||
|
I recently added a custom 404 on my site and it is working. I did it by adding a line to .htaccess like:
ErrorDocument 404 /errorpage.php Try accessing a gibberish page, like www.yourdomain.com/pagedoesnotexist.html and see what happens. That will take your other php coding efforts out of the equation. Once you are getting the right page returned, then you can use an http header check website to make sure your site is actually returning a 404 header. I assume when you tried you created a .htaccess file (starts with a period)? Also, this may only work if you are running Apache web server.
__________________
Looking for a unique gift? Send one of our gourmet cookie bouquets today. Food lovers - visit the Gourmet Gift of the Day Blog for delicious ideas. |
|
||||
|
Quote:
__________________
The Penn State Ticket Man http://www.pennstateticketman.com http://www.happyvalleytickets.com http://www.hounddogtours.com |
|
||||
|
Quote:
Quote:
As a short term measure I'm calling a 301 redirect to an appropriate related page. It does support php as that is the core language used on the site. |
|
||||
|
Just because I didn't see this mentioned yet... is the header() call the absolute first thing you are outputting? There can not be so much as an empty line being sent to the browser before you send header information - the header call should really be contained in the top <?php ?> block, which should have no blank lines above the opening <?php tag.
__________________
The best way to learn anything, is to question everything. |
|
||||
|
Odd; I've have expected a decent pre-processor to ignore any such white-space.
Have you any idea as to whether such behavior is universal or platform dependent?
__________________
The Penn State Ticket Man http://www.pennstateticketman.com http://www.happyvalleytickets.com http://www.hounddogtours.com |
|
||||
|
I believe it was mentioned that, actually.
Quote:
__________________
Dan LeFree | Product Manager (Linux VPS Hosting) | Owner/Operator (Web development, marketing) |
|
||||
|
Quote:
|
|
||||
|
Have you tried using a server side script other than PHP?
__________________
The Penn State Ticket Man http://www.pennstateticketman.com http://www.happyvalleytickets.com http://www.hounddogtours.com |
|
|||
|
If you are handling the 404 error pages in PHP yourself, you need to send out the correct HTTP response header and then DO not redirect the user with a "Location:" link. Most often, this is the case when these issues arise.
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trying to buy a domain but no response | Blitzburgh | Domains Buy/Sell | 7 | 06-08-2009 02:47 AM |
| Response.redirect | realbeard | Search Engine Optimization Forum | 2 | 06-06-2008 11:56 AM |
| http://www.superactive.biz what 's working / not working | jrobin747 | Submit Your Site For Review | 3 | 02-09-2005 12:16 AM |
| Get Response-Autoresponder | ms_promoqueen | Web Programming Discussion Forum | 0 | 03-03-2004 09:51 AM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |