Skip to content

Instantly share code, notes, and snippets.

@dave1010
Created December 14, 2011 13:07
Show Gist options
  • Save dave1010/1476499 to your computer and use it in GitHub Desktop.
Save dave1010/1476499 to your computer and use it in GitHub Desktop.
HTTP Status Cats Apache (htaccess) config
# HTTP Status Cats
# Apache (htaccess) config created by @dave1010
# Licensed CC BY 2.0
# Images CC BY 2.0, from GirlieMac's photostream:
# http://www.flickr.com/photos/girliemac/sets/72157628409467125/with/6508023065/
# Usage: copy save this file as .htaccess or add it to your httpd.conf
ErrorDocument 404 '<a href="http://www.flickr.com/photos/girliemac/6508022985/" title="404 - Not Found by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7172/6508022985_b22200ced0.jpg" width="500" height="400" alt="404 - Not Found"></a>'
ErrorDocument 401 '<a href="http://www.flickr.com/photos/girliemac/6508023065/" title="401 - Unauthorized by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7148/6508023065_8dae48a30b.jpg" width="500" height="400" alt="401 - Unauthorized"></a>'
ErrorDocument 406 '<a href="http://www.flickr.com/photos/girliemac/6508023119/" title="406 - Not Acceptable by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7143/6508023119_b681209a58.jpg" width="500" height="400" alt="406 - Not Acceptable"></a>'
ErrorDocument 408 '<a href="http://www.flickr.com/photos/girliemac/6508023179/" title="408 - Request Timeout by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7018/6508023179_bab3eebce8.jpg" width="500" height="400" alt="408 - Request Timeout"></a>'
ErrorDocument 409 '<a href="http://www.flickr.com/photos/girliemac/6508023259/" title="409 - Conflict by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7010/6508023259_b1c6f5a353.jpg" width="500" height="400" alt="409 - Conflict"></a>'
ErrorDocument 414 '<a href="http://www.flickr.com/photos/girliemac/6508023351/" title="414 - Request-URI Too Long by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7152/6508023351_6732ed2f58.jpg" width="400" height="500" alt="414 - Request-URI Too Long"></a>'
ErrorDocument 502 '<a href="http://www.flickr.com/photos/girliemac/6508023429/" title="502 - Bad Gateway by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7158/6508023429_735b433a36.jpg" width="500" height="400" alt="502 - Bad Gateway"></a>'
ErrorDocument 405 '<a href="http://www.flickr.com/photos/girliemac/6508023523/" title="405 - Method Not Allowed by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7175/6508023523_996188af86.jpg" width="500" height="400" alt="405 - Method Not Allowed"></a>'
ErrorDocument 403 '<a href="http://www.flickr.com/photos/girliemac/6508023617/" title="403 - Forbidden by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7173/6508023617_f3ffc34e17.jpg" width="500" height="400" alt="403 - Forbidden"></a>'
ErrorDocument 417 '<a href="http://www.flickr.com/photos/girliemac/6508023679/" title="417 - Expectation Failed by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7009/6508023679_cb3e88fa92.jpg" width="500" height="400" alt="417 - Expectation Failed"></a>'
ErrorDocument 413 '<a href="http://www.flickr.com/photos/girliemac/6508023747/" title="413 - Request Entity Too Large by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7161/6508023747_1d60889626.jpg" width="500" height="400" alt="413 - Request Entity Too Large"></a>'
ErrorDocument 507 '<a href="http://www.flickr.com/photos/girliemac/6509400503/" title="507 - Insufficient Storage by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7160/6509400503_648dc8a2e5.jpg" width="500" height="400" alt="507 - Insufficient Storage"></a>'
ErrorDocument 508 '<a href="http://www.flickr.com/photos/girliemac/6509400445/" title="508 - Loop Detected by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7025/6509400445_5fd9c7a9c3.jpg" width="500" height="400" alt="508 - Loop Detected"></a>'
ErrorDocument 426 '<a href="http://www.flickr.com/photos/girliemac/6509400771/" title="426 - Upgrade Required by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7167/6509400771_33a1f59890.jpg" width="500" height="400" alt="426 - Upgrade Required"></a>'
ErrorDocument 500 '<a href="http://www.flickr.com/photos/girliemac/6509400855/" title="500 - Internal Server Error by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7001/6509400855_aaaf915871.jpg" width="500" height="400" alt="500 - Internal Server Error"></a>'
ErrorDocument 302 '<a href="http://www.flickr.com/photos/girliemac/6508023829/" title="302 - Found by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7019/6508023829_3d44c4ac16.jpg" width="500" height="400" alt="302 - Found"></a>'
# Apache doesn't seem to like these status codes as ErrorDocuments:
#ErrorDocument 418 '<a href="http://www.flickr.com/photos/girliemac/6508102407/" title="418 - I'm a teapot by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7006/6508102407_a4de65687b.jpg" width="500" height="400" alt="418 - I'm a teapot"></a>'
#ErrorDocument 444 '<a href="http://www.flickr.com/photos/girliemac/6509400599/" title="444 - No Response by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7152/6509400599_52ca022f98.jpg" width="500" height="400" alt="444 - No Response"></a>'
#ErrorDocument 431 '<a href="http://www.flickr.com/photos/girliemac/6509400689/" title="431 - Request Header Fields Too Large by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7144/6509400689_a67d026d0a.jpg" width="500" height="400" alt="431 - Request Header Fields Too Large"></a>'
#ErrorDocument 599 '<a href="http://www.flickr.com/photos/girliemac/6509400929/" title="599 - Network connect timeout error by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7033/6509400929_ced4746ee0.jpg" width="500" height="400" alt="599 - Network connect timeout error"></a>'
#ErrorDocument 429 '<a href="http://www.flickr.com/photos/girliemac/6509400997/" title="429 - Too Many Requests by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7152/6509400997_25bb1bb4fb.jpg" width="500" height="400" alt="429 - Too Many Requests"></a>'
@dave1010
Copy link
Author

302 is the status code for a temporary redirect ("found") so it's not really an error. In fact, only the 400s (client errors) and 500s (server errors) are error codes - so only they should work with Apache's ErrorDocument directive - the 300s are for redirection and 200s are success codes.

@kragen
Copy link

kragen commented Jan 6, 2012

Still, redirect error codes have an entity body attached, for the sake of browsers that don't support redirects. Some versions of Opera around 1998 had trouble with redirects. for example.

@jdickey
Copy link

jdickey commented Jan 27, 2012

Kragen, I love Opera as much as anybody, but anybody still using Opera 3.5 has more severe problems having nothing to do with the browser. I don't even remember Opera offering an embedded version that early, so it couldn't be an old geek toy kept around for auld lang syne.

@jteets
Copy link

jteets commented May 28, 2016

@dave1010 Thanks for this Gist, I'm using my fork in production (site in development at this time, but cats are go). -> https://jonathanteets.com/

@AskApache
Copy link

AskApache commented Aug 16, 2016

@dave1010 I hadn't seen this before, vy nice novel application of this directive. I'm going to experiment with all 60+ ErrorDocuments to see, thanks for the idea!

@munchicken
Copy link

Hi @dave1010, thanks for the inspiration, I just setup HTTP Status Cats on my website and decided to fork your htaccess file and make a few modifications. I included a few additions: changed to the HTTP Status Cats API, centered images using IFrames, added black backgrounds, added all available "status cats" codes, and created a python script to auto-generate all the ErrorDocument statements. https://gist.github.com/munchicken/c606774c0d0b519e4b5b7d2de16a8db2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment