Results 1 to 4 of 4

Thread: Apache error Page (caution: 48kb pic)

  1. #1
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Apache error Page (caution: 48kb pic)

    How Can You have A Custom Error Page With Apache?
    It Was Easy Enough to Figure out With abyss.
    Heres my error Page..
    only a screenshot though.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    If you have cpanel or such, there is likely an option somewhere in that.
    But not sure on the command/system level.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2006
    Posts
    182
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default

    You must have a .htaccess file in your root directory. (A file named .htaccess)
    The file must contain these lines:
    Code:
    ErrorDocument 404 error.php?e=404
    ErrorDocument 500 error.php?e=500
    ...
    You may add/remove/modify them of course.

    The syntax is pretty much selfexplainable:

    ErrorDocument error_code custom_page

  4. #4
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Thanks.

    Here the changes i made to the error file.
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"/>
    <title>BoxxerTrumps | Error</title>
    <link rel="stylesheet" type="text/css" href="styles/css.css"/></head><body>
    <?php include "menu.php";
    $error = array(
    400 => "Bad Request",
    401 => "Authorization Required",
    402 => "Payment Required",
    403 => "Forbidden",
    404 => "Not Found",
    405 => "Method Not Allowed",
    406 => "Not Acceptable",
    407 => "Proxy Authentication Required",
    408 => "Request Timed Out",
    409 => "Conflicting Request",
    410 => "Gone",
    411 => "Content Length Required",
    412 => "Precondition Failed",
    413 => "Request Entity Too Long",
    414 => "Request URI Too Long",
    415 => "Unsupported Media Type",
    );
    $ernum = $_GET[e]; ?>
    <h2>Error <?php echo "$ernum : $error[$ernum]"; ?></h2>
    <?php include "ads.php"; ?>
    </body></html>
    and the htaccess file:
    Code:
    ErrorDocument 400 /error.php?e=400
    ErrorDocument 401 /error.php?e=401
    ErrorDocument 402 /error.php?e=402
    ...403-413...
    ErrorDocument 414 /error.php?e=414
    ErrorDocument 415 /error.php?e=415
    Last edited by boxxertrumps; 12-25-2006 at 04:40 PM.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •