.htaccess set custom error page

Label: com http HTML file TP C doc PHP 00

404Errors can be written like this

ErrorDocument code error.php

If it’s 404 error, jump to file error. PHP

Other common error page writings (of which 404 errors have two writings, the one above and the one below are generic error definitions)

ErrorDocument 404 /error/404.php
ErrorDocument 500 /error/500.php
ErrorDocument 400 /error/400.php
ErrorDocument 401 /error/401.php
ErrorDocument 403 /error/403.php
ErrorDocument 503 /error/503.php
  • If it’s a 404 error, jump to the 404. PHP file in the error directory
  • If it’s 500 errors, jump to the 500.php file in the error directory
  • And so on

Note: When I tested in the local Apache environment, when the folder was error, I could not read the wrong file and the other file names were normal. Maybe it is in conflict with the default settings of my environment. If you encounter this situation, you can change the file name.

Reprint: http://www.sjyhome.com/htaccess/custom-error-pages.html

.htaccessSetting up custom error pages

Label: com http HTML file TP C doc PHP 00

Original: http://www.cnblogs.com/psz1992/p/4442950.html

Leave a Reply

Your email address will not be published. Required fields are marked *