Skip to content

Instantly share code, notes, and snippets.

@apphp-snippets
Created August 18, 2013 09:27
Show Gist options
  • Save apphp-snippets/6260745 to your computer and use it in GitHub Desktop.
Save apphp-snippets/6260745 to your computer and use it in GitHub Desktop.
This example shows you how to define custom error pages in .htaccess file and also how to display the error page on your site.
# Sample 1: redirect errors to html files
ErrorDocument 400 /400.html
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 405 /405.html
ErrorDocument 408 /408.html
ErrorDocument 414 /414.html
ErrorDocument 500 /500.html
ErrorDocument 502 /502.html
ErrorDocument 504 /504.html
# Sample 2: redirect errors to PHP file
ErrorDocument 400 /error.php?q=400
ErrorDocument 401 /error.php?q=401
ErrorDocument 403 /error.php?q=403
ErrorDocument 404 /error.php?q=404
ErrorDocument 405 /error.php?q=405
ErrorDocument 408 /error.php?q=408
ErrorDocument 414 /error.php?q=414
ErrorDocument 500 /error.php?q=500
ErrorDocument 502 /error.php?q=502
ErrorDocument 504 /error.php?q=504
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment