.htaccess Custom Error Pages and Messages
.htaccess Custom Error Pages and Messages
In .htaccess, you can provide custom error pages for users depending on the type of error they receive.
The error pages are presented as URLs. These URLs can begin with a slash (/
) for local web-paths (relative to the DocumentRoot), or be a full URL which the client can resolve.
Alternatively, a message can be provided to be displayed by the browser.
ErrorDocument 500 /errors/500.html
ErrorDocument 404 /errors/400.html
ErrorDocument 401 https://example.com/path/my-page.html
ErrorDocument 403 "Sorry, can't allow you access today"
note
See the ErrorDocument Directive documentation on the HTTPD documentation site for more information.