I found the command
header("HTTP/1.1 404 Not Found");
for displaying that a page was nto found.
It however produces only an empty page.
Is the code wrong, or what is the problem ?
Matthias Pospiech
header("HTTP/1.1 404 Not Found"); shows only empty
Moderator: General Moderators
-
TheBentinel.com
- Forum Contributor
- Posts: 282
- Joined: Wed Mar 10, 2004 1:52 pm
- Location: Columbus, Ohio
Re: header("HTTP/1.1 404 Not Found"); shows only e
The header is only seen by the browser, it isn't displayed to the user. You would also need to put in some sort of "Sorry, we don't have a file like that" text. You may not need to send any header info, your server probably is handling that for you. I have a custom 404 page on my site, but it's static HTML. The server throws it at you if you request a file that doesn't exist, and adds a 404 header automatically. (Linux/Apache)pospiech wrote:I found the command
header("HTTP/1.1 404 Not Found");
for displaying that a page was nto found.
It however produces only an empty page.
Is the code wrong, or what is the problem ?
Matthias Pospiech
-
TheBentinel.com
- Forum Contributor
- Posts: 282
- Joined: Wed Mar 10, 2004 1:52 pm
- Location: Columbus, Ohio
That's cool. Just put some text in the page. Whatever you want to say to your users. Since I run a site with various articles, I put my current article headlines on my 404 page. If somebody mistypes a url, they at least get a page that represents my site and suggests articles they might want to read.pospiech wrote:The reason I need it, is that other wise php will send an error to the page that it did not find a file.
Now I check and want to send a 404 Page instead - with this command. It however presents only an empty page.
Matthias
Treat it like any other PHP page on your site, except you include whatever headers you want before outputting any HTML.
Or am I missing your point altogether? If I am, I'm sorry. Feel free to knock me back on track.