Tag Archives: errors

HTTP response error messages

As part of my webspace I wanted to add some humorous error pages to soften the blow when there’s a problem.


Live page
GitHub repository


This project works in two distinct phases: first the .htaccess file catches HTTP responses and redirects them before the client’s browser can display an error page, and second the PHP script interprets the redirected URI and displays the relevant message. For whimsy, a random comic from Lore Brand Comics is shown. I’ve loosely followed Lore Sjoeberg’s work since the Brunching Shuttlecocks started in the mid ’90s.


Challenge: .htaccess must catch a relative path from anywhere in the domain.
Solution: For some reason this eluded me for years. On receiving an HTTP request error, the .htaccess used to redirect to an absolute path, including the full domain name, which meant that the PHP script didn’t know the original URI. Once I fixed this issue I could provide more useful information for the client. (Resolved)
Challenge: The data for each constituency varies in its content and structure.
Solution: The data contains various parties and candidates which vary from constituency to constituency. As a result the data processing must be able to add an arbitrary list of candidates and parties per constituency. This turned out to be trivial, using the database schema, but did add another layer of complexity to the project. (Resolved)


An error 404 message
An error 404 message