Redirect on "error 404 page not found"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rcb845@yahoo.fr

    Redirect on "error 404 page not found"

    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
  • Gert

    #2
    Re: Redirect on "error 404 page not found"

    > I have defined my personal error file.[color=blue]
    > I have modified the apache configuration httpd.conf to point to this
    > file (see below).[/color]

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

    Gert


    Comment

    • Bert

      #3
      Re: Redirect on "error 404 page not found"

      On 13 Sep 2004 01:43:36 -0700, rcb845@yahoo.fr (rcb845@yahoo.f r)
      wrote:

      <using custom error page in apache>[color=blue]
      >
      >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.[/color]

      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.

      Comment

      • rcb845@yahoo.fr

        #4
        Re: Redirect on &quot;error 404 page not found&quot;

        "Gert" <gert@mellak.co m> wrote in message news:<ci3qqo$a5 i$1@newsreader1 .utanet.at>...[color=blue][color=green]
        > > I have defined my personal error file.
        > > I have modified the apache configuration httpd.conf to point to this
        > > file (see below).[/color]
        >
        > .. and you did think of restarting your server, right?
        >
        > Gert[/color]


        Tks for the info, but YES I restarted the server
        RCB845

        Comment

        • Alvaro G. Vicario

          #5
          Re: Redirect on &quot;error 404 page not found&quot;

          *** rcb845@yahoo.fr escribió/wrote (13 Sep 2004 01:43:36 -0700):[color=blue]
          > 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.[/color]

          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
          --

          Comment

          • rcb845@yahoo.fr

            #6
            Re: Redirect on &quot;error 404 page not found&quot;

            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

            Comment

            • Shawn Wilson

              #7
              Re: Redirect on &quot;error 404 page not found&quot;



              "Alvaro G. Vicario" wrote:[color=blue]
              >
              > *** rcb845@yahoo.fr escribió/wrote (13 Sep 2004 01:43:36 -0700):[color=green]
              > > 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.[/color]
              >
              > 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.[/color]

              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
              shawn@glassgian t.com

              Comment

              Working...