404 Page not found

Discussion in 'HTML & Website Design' started by alexei_aus, Jun 6, 2007.

  1. #1
    What is the code to put into .htaccess file in order to make all the people go to the main index page if then stumble upon a 404 Page not found? Is there another way of doing it?
     
    alexei_aus, Jun 6, 2007 IP
  2. dcristo

    dcristo Illustrious Member

    Messages:
    19,776
    Likes Received:
    1,200
    Best Answers:
    7
    Trophy Points:
    470
    Articles:
    7
    #2
    You don't want to do it like that. Setup a custom 404 error page and redirect your visitors to that page.
     
    dcristo, Jun 6, 2007 IP
  3. n-james

    n-james Well-Known Member

    Messages:
    1,367
    Likes Received:
    70
    Best Answers:
    0
    Trophy Points:
    165
    #3
    n-james, Jun 6, 2007 IP
  4. rspenc29

    rspenc29 Peon

    Messages:
    256
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I use this code in my .htaccess

    ErrorDocument 404 /sitemap.php?id=404
    Code (markup):
    Then on my sitemap page add a few lines of text above the sitemap if its a 404 page.

    <?php
    if(isset($_GET['id']) && $_GET['id'] == "404")
    {
         print '<h1>Error!</h1>';
         print '<p>The page you were looking for was not found on our server.<br />';
         print 'Please browse our sitemap below to find what you were looking for.</p>';
    }
    ?>
    PHP:
     
    rspenc29, Jun 7, 2007 IP
  5. elfboy

    elfboy Guest

    Messages:
    221
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    rspenc29 has a very good way of doing it, i also use this way but also make it send me an email upon reciving this error.
     
    elfboy, Jun 8, 2007 IP