By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,663 Members | 1,455 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,663 IT Pros & Developers. It's quick & easy.

Redirect on "error 404 page not found"

P: n/a
HI fellow php fans,

I am blocked with a simple problem, at least it seems simple,
but I cannot make it through.
I want to execute a .php script in case of "error 404, page not
found".
I am not yet on a production server but on my local Apache server.

I have defined my personal error file.
I have modified the apache configuration httpd.conf to point to this
file (see below).

QUOTE
#
# Customizable error response (Apache style)
# these come in three flavors
#
# 1) plain text
#ErrorDocument 500 "The server made a boo boo.
# n.b. the single leading (") marks it as text, it does not get
output
#
# 2) local redirects
#
# RCB 10.9.2004
#
ErrorDocument 404 /gfmer_404.php
#ErrorDocument 404 /missing.html
#
# to redirect to local URL /missing.html
#ErrorDocument 404 /cgi-bin/missing_handler.pl
# N.B.: You can redirect to a script or a document using
server-side-includes.

UNQUOTE

When I try to load a non-existing page, it never comes to my above
defined gfmer_404.php file.
The standard error file-not-found is always displayed.

Do I miss something somewhere ?
Tks very much for your precious help.

RCB845
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
> I have defined my personal error file.
I have modified the apache configuration httpd.conf to point to this
file (see below).


... and you did think of restarting your server, right?

Gert
Jul 17 '05 #2

P: n/a
On 13 Sep 2004 01:43:36 -0700, rc****@yahoo.fr (rc****@yahoo.fr)
wrote:

<using custom error page in apache>

When I try to load a non-existing page, it never comes to my above
defined gfmer_404.php file.
The standard error file-not-found is always displayed.


By "standard error file-not-found" do you mean the page Internet
Explorer shows? In that case try adding some extra code to your custom
page (for example some html-comments with some text in it).
Internet Explorer ignores custom error documents that are less than
512 bytes...
HTH,
B.

Jul 17 '05 #3

P: n/a
"Gert" <ge**@mellak.com> wrote in message news:<ci**********@newsreader1.utanet.at>...
I have defined my personal error file.
I have modified the apache configuration httpd.conf to point to this
file (see below).


.. and you did think of restarting your server, right?

Gert

Tks for the info, but YES I restarted the server
RCB845
Jul 17 '05 #4

P: n/a
*** rc****@yahoo.fr escribió/wrote (13 Sep 2004 01:43:36 -0700):
When I try to load a non-existing page, it never comes to my above
defined gfmer_404.php file.
The standard error file-not-found is always displayed.


Check whether there's another ErrorDocument directive overriding yours.
Also, please note Internet Explorer doesn't display short error pages by
default: you have to uncheck "Show descriptive messages on http errors" (or
similar text, I'm translating from Spanish) in Internet Options.
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions
--
Jul 17 '05 #5

P: n/a
Tks to all of you for your advices.
I think, the error I made, was that the personal
error file was not in the root directory of easyphp, but
in another directory.

Now I changed, I put it in the root directory with
a redirection to the personal file I want.

Problem is solved, tks very much
RCB845
Jul 17 '05 #6

P: n/a


"Alvaro G. Vicario" wrote:

*** rc****@yahoo.fr escribió/wrote (13 Sep 2004 01:43:36 -0700):
When I try to load a non-existing page, it never comes to my above
defined gfmer_404.php file.
The standard error file-not-found is always displayed.


Check whether there's another ErrorDocument directive overriding yours.
Also, please note Internet Explorer doesn't display short error pages by
default: you have to uncheck "Show descriptive messages on http errors" (or
similar text, I'm translating from Spanish) in Internet Options.


The easiest way around this is to make sure your page is more than 512 bytes.
IE should display custom error pages bigger than that.

NOTE: The 512 doesn't include images, css or js files. Nor does it include PHP
code, obviously. I put a bunch of "&nbsp;" in my 404s to pad them above that
limit.

Shawn

--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.