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
# .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.
<?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.
0 comments:
Post a Comment
We are not responsible for comments expressed within this site. It is the account holder's personal views and all risks of comments posted his own account owner's responsibility. Comments wisely as it showed your maturity.
Click to see the code!
To insert emoticon you must added at least one space before the code.