learning from errors

When something isn’t working right on a website I most often turn to reviewing errors to figure out what’s broken. They can be overwhelming unless you know where to focus and what you can ignore. Learning some basics of error reading can be helpful when trying to decide if it’s something that a you can fix yourself or if you need an expert. For websites, there are different places we can look when something isn’t right.

HTML Error Codes

First is the standard 404 web page error, meaning that the server couldn’t find the file (link) that the web browser asked for. While some 404 error pages can make you smile, and others try to help guide you to find the proper link, the reason you end up there is the same — something is missing.

There are several questions to ask when you unexpectedly experience a 404 page. These include:

  • Is it the proper URL? Is there a typo? For example www.example.com/sample.html is not the same as www.example.com/sample.php
  • If you are looking for something in your WordPress site, did you publish it?
  • Is it a caching issue?
Tools in your web browser

Both Firefox and Chrome include tools to help you further debug your website. Both Firefox’s Web Console Chrome’s DevTools include tools to help you diagnose CSS, Javascript, performance, and more. There are also extensive tutorials within each browser’s documentation.

On your web server

The error log produced by your web server is very detailed. Each webhost has different access methods, one of the most common is through cpanel. Each line of the log is a new entry, you can see when the error was logged, the IP address of the computer that generated the error, and some information about what’s wrong. Depending on the error and the original developer, you may receive detailed information about what’s wrong or a simplified note.

Error log review in practice

Recently I reviewed a client’s error log because it was experiencing “high load” and responding sluggishly. I thought I knew what the problem was and was surprised to find the error log full of 404 errors. My next thought was malicious code, I recently inherited administration of this server and am still getting up to speed. As I looked closer, I recognized a simple pattern, they were all for @2x.jpg image files. My immediate concern was to reduce the impact all these not-really-missing files were having on the server. Now that is addressed, I’ll work on the issue of retina optimized images. The solution was a quick one, adding a few lines to the .htaccess file. Without reviewing the server’s error log, the solution would have been much more difficult to fix.