public
Last active

HTTP Status Cats Apache (htaccess) config

  • Download Gist
htaccess
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
# 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>'

Please let us know if you use any of these in production!

@dave1010 302 isn't really an error response code :)

Well spotted but Apache doesn't mind the ErrorDocument directive for some reason. I have no idea what it does with it. I guess that cat will never be seen.

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.

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.

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.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.