ezadx10b
New Member
- Messages
- 29
- Reaction score
- 0
- Points
- 1
Very useful if you point all your error pages to the same file. Save more space and easy to handle it.. rite ?
This is a sample 'REDIRECT_STATUS' to your error page. First you need to use .htaccess file to point your 'REDIRECT_STATUS' to one file. Use this code
This is a sample 'REDIRECT_STATUS' to your error page. First you need to use .htaccess file to point your 'REDIRECT_STATUS' to one file. Use this code
# .htaccess file.
ErrorDocument 404 /error-msg.php
ErrorDocument 500 /error-msg.php
ErrorDocument 400 /error-msg.php
ErrorDocument 401 /error-msg.php
ErrorDocument 403 /error-msg.php
# End of file.
Now your error 404,500,400,401 and 403 have point to file /error-msg.php. Now on your error-msg.php use this php code.ErrorDocument 404 /error-msg.php
ErrorDocument 500 /error-msg.php
ErrorDocument 400 /error-msg.php
ErrorDocument 401 /error-msg.php
ErrorDocument 403 /error-msg.php
# End of file.
<?php
$HttpStatus = $_SERVER["REDIRECT_STATUS"] ;
if($HttpStatus==200) {print "Error 200-Document has been processed and sent to you.";}
if($HttpStatus==400) {print "Error 400-Bad HTTP request ";}
if($HttpStatus==401) {print "Error 401-Unauthorized - Iinvalid password";}
if($HttpStatus==403) {print "Error 403-Forbidden Area";}
if($HttpStatus==500) {print "Error 500-Internal Server Error";}
if($HttpStatus==418) {print "Error 418-I'm a teapot! - This is a real value, defined in 1998";}
?>
Hope this useful. $HttpStatus = $_SERVER["REDIRECT_STATUS"] ;
if($HttpStatus==200) {print "Error 200-Document has been processed and sent to you.";}
if($HttpStatus==400) {print "Error 400-Bad HTTP request ";}
if($HttpStatus==401) {print "Error 401-Unauthorized - Iinvalid password";}
if($HttpStatus==403) {print "Error 403-Forbidden Area";}
if($HttpStatus==500) {print "Error 500-Internal Server Error";}
if($HttpStatus==418) {print "Error 418-I'm a teapot! - This is a real value, defined in 1998";}
?>