-
January 23rd, 2005, 11:50 PM
#1
PHP header()
Quick question, this is such a little problem but I need to get it working. I need PHP to send a browser to it's local 404 page, exactly the same way it would if a page didn't exist. Here's what I'm trying:
PHP Code:
<?php
header("HTTP/1.0 404 Not Found");
?>
This page should send your browser to a 404 page located on your filesystem, however it isn't on the servers I'm using. A "location:" redirect works fine, however this doesn't. The most embarrasing part is that I pulled that code directly from the PHP site, and it still doesn't work.
I'm reading this but most of it is going over my head:
http://us4.php.net/header
What can I do with php to get the browser to show the local filesystem's 404 page?
-
January 24th, 2005, 12:42 AM
#2
Doesn't this only work if Apache is configured correctly through ErrorDocuments? I don't think that script can be used universally...
Edit:
PHP Code:
<?php
header("HTTP/1.1 404 Not Found");
?>
doesn't do anything in Firefox, but it does work in IE... Can it be that Firefox strips the headers or something?
-
February 8th, 2005, 09:26 PM
#3
-
February 15th, 2005, 01:18 AM
#4
Junior Member
all that header command is doing is defining that the page you are sending doesnt exist, it is sending the 404 error.
if you want it to go to the actual 404 error page you have defined in the .htaccess you will have to either include it yourself and generate it as part of the page or redirect to it using :
header ('Locate http://domain/404error.html');
or what have you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|