404 error file

Discussion in 'HTML' started by thedarkman, Oct 31, 2013.

  1. thedarkman

    thedarkman Guest

    I want to create one of these so that in the event of a broken link the user gets a message like here

    http://www.digitaljournal.com/article/360991

    redirecting to the Internet Archive.

    I read up on the .htaccess file but creating one of those simply makes my directories disappear. I can't find a simple one either. Can anyone point me in the right direction?

    Thanks
    thedarkman, Oct 31, 2013
    #1
    1. Advertising

  2. thedarkman wrote:

    > I want to create one of these so that in the event of a broken link
    > the user gets a message like here
    >
    > http://www.digitaljournal.com/article/360991
    >
    > redirecting to the Internet Archive.
    >
    > I read up on the .htaccess file but creating one of those simply
    > makes my directories disappear. I can't find a simple one either. Can
    > anyone point me in the right direction?


    You're probably looking for the ErrorDocument directive[1].

    [1] <http://httpd.apache.org/docs/2.2/mod/core.html#errordocument>

    --
    Christoph M. Becker
    Christoph Michael Becker, Oct 31, 2013
    #2
    1. Advertising

  3. thedarkman

    thedarkman Guest

    This is a very long document and I can't make much sense of it. I want to create a htaccess file and an error file for the site. All I need is a brief bit of code for both. Also what do I call the error file? error.html?

    Thanks
    thedarkman, Nov 6, 2013
    #3
  4. On Thu, 31 Oct 2013 14:55:45 -0700, thedarkman wrote:

    > I read up on the .htaccess file but creating one of those simply makes
    > my directories disappear. I can't find a simple one either. Can anyone
    > point me in the right direction?


    In theory, the following single line in an .htaccess file should work:

    ErrorDocument 404 http://archive.org/

    However this does rely upon the server configuration (probably controlled
    by your hosting provider) allowing you to use this directive in
    an .htaccess file.

    If you want to specify a document on your own website, use:

    ErrorDocument 404 /path/to/file.text

    where the /path/to/file.ext is relative to the root of the website.

    eg if the full url is:

    http://www.domain.tld/path/to/file.ext

    Then use:

    ErrorDocument 404 /path/to/file.ext

    but if the full url is

    http://www.domain.tld/bing/bang/bong/file.ext

    Then use:

    ErrorDocument 404 /bing/bang/bong/file.ext

    Note that ext should probably be something that the server associates
    with web content, ideally .[x]htm[l] or .php etc, and also note that if
    you screw it up, all sorts of weird shit happens.

    --
    Denis McMahon,
    Denis McMahon, Nov 6, 2013
    #4
  5. Ed Mullen wrote:

    > The 404 file looks like this:
    >
    > http://edmullen.net/404_error_not_found.php


    Just a tip Ed, if you switched technologies that changed your URLs what
    not alleviate one condition by adding to your .htacess file

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^(.*)\.html$ $1.php [R=301,NC,L]
    </IfModule>




    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Nov 6, 2013
    #5
  6. thedarkman

    Guest

    Hi,

    the code you recommended works; I put it in the .htaccess file, and entering a bad url takes it straight to the Internet Archive. What I would really like to do though is get it to display the message on this page:
    http://blog.archive.org/2013/10/24/web-archive-404-handler-for-webmasters/

    they give the following code for the error file:
    <div id="wb404"/>
    <script src="https://archive.org/web/wb404.js"> </script>

    this does not seem to work.

    Can you give it one more try so I can display the message?

    Thanks
    , Nov 13, 2013
    #6
  7. On Tue, 12 Nov 2013 16:42:19 -0800, odemgoldenslippers wrote:

    > Hi,
    >
    > the code you recommended works; I put it in the .htaccess file, and
    > entering a bad url takes it straight to the Internet Archive. What I
    > would really like to do though is get it to display the message on this
    > page:
    > http://blog.archive.org/2013/10/24/web-archive-404-handler-for-

    webmasters/
    >
    > they give the following code for the error file:
    > <div id="wb404"/>
    > <script src="https://archive.org/web/wb404.js"> </script>
    >
    > this does not seem to work.
    >
    > Can you give it one more try so I can display the message?


    You need to create your own 404 error page, point the ErrorDocument 404
    at your error page, and include their code in your error page.

    Note that in order for this to work, your error page has to be dtd valid
    xhtml, and if you're who I think you are, that means you're probably
    stuffed, because the person I associate the OP with has for years been
    insisting on forcing broken html 1/2/3/4 tag soup into browsers to the
    point that they run out of memory trying to map his broken interleaved
    elements into a dom, and probably couldn't write valid xhtml to save his
    life.

    Of course, I may be making the wrong association, and you may not be a
    nymshift of the OP.

    --
    Denis McMahon,
    Denis McMahon, Nov 13, 2013
    #7
    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. Jonathan Folland
    Replies:
    2
    Views:
    1,608
    Jonathan Folland
    Mar 17, 2005
  2. Replies:
    3
    Views:
    968
    HalcyonWild
    Oct 14, 2005
  3. Bishop
    Replies:
    1
    Views:
    753
    Bishop
    Feb 24, 2007
  4. Replies:
    0
    Views:
    412
  5. Help Needed
    Replies:
    1
    Views:
    258
    Jason M. Murray
    Sep 19, 2003
Loading...

Share This Page