change 'not found' page

Discussion in 'HTML' started by Lloyd, Dec 24, 2004.

  1. Lloyd

    Lloyd Guest

    Is there a way to change what a person sees on my site when they type in,
    or get a bad url?
    I see this:
    The page cannot be found
    On other sites I see different messages, I would like to customise mine.
    Thanks in advance,
    Lloyd
     
    Lloyd, Dec 24, 2004
    #1
    1. Advertising

  2. Lloyd

    Neal Guest

    On Fri, 24 Dec 2004 22:27:54 GMT, Lloyd <> wrote:

    > Is there a way to change what a person sees on my site when they type
    > in,
    > or get a bad url?
    > I see this:
    > The page cannot be found
    > On other sites I see different messages, I would like to customise mine.


    This assumes you are on an Apache or similar server.

    Create an error page, save it as say "error.html".

    Then in a blank document add this line:

    ErrorDocument 404 http://www.example.com/error.html

    replacing your domain and path to the error document for the example path
    above.

    Save this file to your root directory with the name ".htaccess" - dot and
    all.
     
    Neal, Dec 24, 2004
    #2
    1. Advertising

  3. Lloyd

    Lloyd Guest

    > On Fri, 24 Dec 2004 22:27:54 GMT, Lloyd <> wrote:
    >
    >> Is there a way to change what a person sees on my site when they type
    >> in,
    >> or get a bad url?
    >> I see this:
    >> The page cannot be found
    >> On other sites I see different messages, I would like to customise mine.

    >
    > This assumes you are on an Apache or similar server.
    >
    > Create an error page, save it as say "error.html".
    >
    > Then in a blank document add this line:
    >
    > ErrorDocument 404 http://www.example.com/error.html
    >
    > replacing your domain and path to the error document for the example path
    > above.
    >
    > Save this file to your root directory with the name ".htaccess" - dot and
    > all.


    Thak you! I'll give it a shot
    Merry Christmas......
     
    Lloyd, Dec 24, 2004
    #3
  4. Lloyd

    Lloyd Guest

    > Create an error page, save it as say "error.html".
    >
    > Then in a blank document add this line:
    >
    > ErrorDocument 404 http://www.example.com/error.html
    >
    > replacing your domain and path to the error document for the example path
    > above.
    >
    > Save this file to your root directory with the name ".htaccess" - dot and
    > all.


    it's an Apache server, I followed all instructions:
    it would not let me make a file called .htaccess on my win xp so after I
    uploaded it using cuteftp, I renamed it and it disappeared! When I type a
    bad url in, it just does nothing, (xp flag keeps waving)
    How to I find my .htacess if I need to edit it?
    Thanks
    Lloyd
     
    Lloyd, Dec 24, 2004
    #4
  5. Lloyd

    Neal Guest

    On Fri, 24 Dec 2004 23:26:37 GMT, Lloyd <> wrote:

    > it would not let me make a file called .htaccess on my win xp so after I
    > uploaded it using cuteftp, I renamed it and it disappeared!


    XP probably does not recognize it as real, it's pretty stupid.

    > When I type a
    > bad url in, it just does nothing, (xp flag keeps waving)
    > How to I find my .htacess if I need to edit it?


    You can only access it with FTP, really. I use Crimson Editor
    <http://www.crimsoneditor.com/> to do most uploading and editing. If your
    FTP program isn't working try that. It's a free download.

    When you FTP in you should see all the files in your main directory,
    ..htaccess should be there. If not, you should be able to create it with CE.
     
    Neal, Dec 24, 2004
    #5
  6. Lloyd

    Lloyd Guest

    I got it working, I was calling error.html and had error.htm (missing 'l'),
    I still can't find the .htaccess file, does it become hidden on the server
    directory?
    Thanks
     
    Lloyd, Dec 24, 2004
    #6
  7. Lloyd

    Dylan Parry Guest

    Lloyd wrote:

    > I still can't find the .htaccess file, does it become hidden on the server
    > directory?


    Yes, the "." in the filename is a Unix convention for specifying that a
    file should be hidden. You should be able to find a setting somewhere in
    your FTP client that allows you to see hidden files though.

    --
    Dylan Parry
    http://webpageworkshop.co.uk -- FREE Web tutorials and references
     
    Dylan Parry, Dec 24, 2004
    #7
  8. Lloyd

    Richard Guest

    Lloyd wrote:

    > Is there a way to change what a person sees on my site when they type in,
    > or get a bad url?
    > I see this:
    > The page cannot be found
    > On other sites I see different messages, I would like to customise mine.
    > Thanks in advance,
    > Lloyd


    Ask your host how to proceed with customizable 404 pages before doing it on
    your own.
     
    Richard, Dec 25, 2004
    #8
  9. Lloyd

    Lloyd Guest

    > Ask your host how to proceed with customizable 404 pages before doing it
    > on
    > your own.
    >

    I have it all fixed thanx to other posters, merry Christmas!
     
    Lloyd, Dec 25, 2004
    #9
  10. "Lloyd" <> wrote:

    > Is there a way to change what a person sees on my site when they
    > type in,
    > or get a bad url?


    Probably. Others have already discussed the technicalities.

    > On other sites I see different messages, I would like to customise
    > mine.


    While that's understandable, and recommended by useability experts, it
    is _very_ easy to go wrong and create an error page that is _worse_
    than the default one, at least for a large number of potential users.
    A common error (when the pages are not in English) is to include the
    error message in the language of the pages _only_.

    So make sure you are making an improvement, so that the error page is
    more understandable and more informative. For some notes see
    http://www.cs.tut.fi/~jkorpela/www/404.html

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Dec 25, 2004
    #10
  11. .oO(Neal)

    >ErrorDocument 404 http://www.example.com/error.html


    Should be

    ErrorDocument 404 /error.html

    Using an absolute URL for error documents will overwrite the original
    status code and send a 302 redirect back to the client. Not really what
    you want.

    Micha
     
    Michael Fesser, Dec 31, 2004
    #11
  12. Lloyd

    Neal Guest

    On Fri, 31 Dec 2004 04:31:40 +0100, Michael Fesser <> wrote:

    > .oO(Neal)
    >
    >> ErrorDocument 404 http://www.example.com/error.html

    >
    > Should be
    >
    > ErrorDocument 404 /error.html
    >
    > Using an absolute URL for error documents will overwrite the original
    > status code and send a 302 redirect back to the client. Not really what
    > you want.


    Thanks, but confused. I know it will forward to the file OK, I have it set
    up that way on a site and have never had an issue to my knowledge. But
    explain again on the 302 bit. Pretend I am dumber than I actually am ;)
     
    Neal, Dec 31, 2004
    #12
  13. Lloyd

    Duende Guest

    While sitting in a puddle Neal scribbled in the mud:

    > Pretend I am dumber than I actually am ;)


    Can't be done. <g>

    --
    D?
    If it ain't broken fix it anyway.
     
    Duende, Dec 31, 2004
    #13
  14. .oO(Neal)

    >On Fri, 31 Dec 2004 04:31:40 +0100, Michael Fesser <> wrote:
    >
    >> Using an absolute URL for error documents will overwrite the original
    >> status code and send a 302 redirect back to the client. Not really what
    >> you want.

    >
    >Thanks, but confused. I know it will forward to the file OK, I have it set
    >up that way on a site and have never had an issue to my knowledge. But
    >explain again on the 302 bit. Pretend I am dumber than I actually am ;)


    If there's an error then it should be clearly stated as such to the user
    agent, i.e. the server should respond with the correct error code. A
    proper description of the current situation allows the user agent to
    react accordingly, for example to remove the page in question from his
    cache or index if its not available anymore.

    But if the server responds with a redirect instead, it's more or less
    like "OK, document found." There's no indication that an error occured
    anymore, the user agent will believe that the address is still valid.

    This becomes even more important and a real problem when doing HTTP
    authentication, where the status 401 ("Unauthorized") is involved. An
    absolute URL in the definition of the error document will break the
    authentication mechanism, because now the browser won't receive the
    original 401 status code and therefore won't show the login dialog.

    Micha
     
    Michael Fesser, Dec 31, 2004
    #14
  15. Neal <> wrote:

    >> Using an absolute URL for error documents will overwrite the
    >> original status code and send a 302 redirect back to the client.
    >> Not really what you want.

    >
    > Thanks, but confused. I know it will forward to the file OK, I have
    > it set up that way on a site and have never had an issue to my
    > knowledge. But explain again on the 302 bit. Pretend I am dumber
    > than I actually am ;)


    May I?

    The status code (return code) is the server's primary way of telling
    the browser (or other client) about the success of the request to get a
    document at a specific URL. It may be accompanied with an actual
    document, such as an HTML document, which could be the one the user
    really wanted, or an explanation accompanying a status code that
    indicates an error.

    Normal processing of "not found" errors means that the server returns
    code 404 and possibly an accompanying explanation. What you want is to
    make sure the accompanying explanation is one that you wrote, instead
    of the server's default.

    What's wrong with Apache's behavior of sending the status code 302
    (when an absolute URL is specified) is that it would indicate that the
    original URL (in the request, e.g. as typed by the user or as written
    into a link he followed) _works_ and the requested resource exists but
    temporarily resides under a different URL! This would cause quite a lot
    of confusion among users, search engines, etc.

    For example, suppose you have created a Web page and you wish to use a
    link checker (such as the one at w3c.org) to verify that all of your
    links work in some technical sense at least. If you have actually
    mistyped a link, the link checker will note a status code of 404 as an
    error, so that you can fix the problem. But if the status code is 302,
    there is no error to be reported; the checker could at most issue an
    informative message about redirection.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Dec 31, 2004
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William Parker
    Replies:
    1
    Views:
    3,108
    Martin
    Jun 27, 2004
  2. Samy
    Replies:
    0
    Views:
    544
  3. Replies:
    3
    Views:
    566
  4. Trent Mick
    Replies:
    0
    Views:
    484
    Trent Mick
    Apr 3, 2008
  5. Jacob Davis
    Replies:
    0
    Views:
    509
    Jacob Davis
    Apr 15, 2008
Loading...

Share This Page