View Full Version : Apache error Page (caution: 48kb pic)
boxxertrumps
12-23-2006, 09:51 PM
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.
http://i119.photobucket.com/albums/o141/boxxertrumps/Error.jpg
djr33
12-24-2006, 04:01 AM
If you have cpanel or such, there is likely an option somewhere in that.
But not sure on the command/system level.
You must have a .htaccess file in your root directory. (A file named .htaccess)
The file must contain these lines:
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
boxxertrumps
12-25-2006, 02:08 AM
Thanks.
Here the changes i made to the error file.
<!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:
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
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.