Errors on your website are never desired nor having sense. In order to improve the experience, you should get rid of it. But why, you may ask? It doesn’t hurt anybody … Oh, it does!
Every time a website indicates that your browser need to load resource X, it opens a connection to your web server and requests this resource. If it’s not available, the server returns the HTTP error status 404, which indicates, that the requested file could not be found on the web server and thus cannot be served.
Improve Website Performance
This way, every file that returns a 404 error message is a superfluous request since there is no benefit in having it. Thus the browser works on something and is waisting resources. And especially the bandwidth of the user is used without benefit. In modern times with many mobile users, there should be no request without benefit. And thus you should care about your website’s 404 errors.
Improve User Experience
If website performance is not enough, add User Experience to the improvements list. Every error on your website is one error too much, since it usually means something on your website is not how it’s meant to be. This would harm the user experience of all visitors. By fixing such errors, you get a website with less errors and thus a better user experience.
Improve Server Performance
But not only on the user’s side you will gain a benefit from having no 404 errors on your website: Your web server needs to look for non-existing files every time they’re getting requested. Additionally, by default, it logs the request twice, in the access.log and in the error.log. Since files that are not available cannot be cached in the web server’s page cache, it cannot be read from the cache – as frequently requested other files can.
This way you’re also waisting resources on the web server side and having a higher load on your server than you might want – since you want it to be as fast as possible, won’t you? And by using unnecessary resources you might also think about the climate change and what it’s meant to waist resources. Yes, it might be a little if you optimize your website. But think about the global waist of resources and how you are able to reduce it a little bit. And maybe you can spread the word and get other website administrators to think about their 404 errors.
All errors matter
I did focus on 404 errors in the previous parts, but there are many errors more … Since you cannot fix all of them, you could – and should – take at least a look into it. All error messages and what they mean can be found on Wikipedia.
Monitoring errors
The easiest way to track your effort in fixing errors on your site is monitoring them. In my case, I use Munin to monitor my server, and even my access logs. This way I can see if everything runs fine or if there are unusual error messages being logged.
By improving my own websites, I love to share you the progress and if it’s visible in the monitoring. The optimization was done in the night from 17th April to 18th April.
One note though: Even if your website has no more errors, it’s likely that you still have some error messages logged. Usually, they come from automatic scripts, spiders and bots. They may look like this:
[18/Apr/2020:18:10:52 +0200] "GET /?author=2 HTTP/1.1" 404 10773 "-" "Apache-HttpClient/4.5.2 (Java/1.8.0_161)"
[18/Apr/2020:18:10:56 +0200] "GET /?author=3 HTTP/1.1" 404 10773 "-" "Apache-HttpClient/4.5.2 (Java/1.8.0_161)"
[18/Apr/2020:18:11:03 +0200] "GET /?author=6 HTTP/1.1" 404 10773 "-" "Apache-HttpClient/4.5.2 (Java/1.8.0_161)"
[18/Apr/2020:18:11:05 +0200] "GET /?author=7 HTTP/1.1" 404 10774 "-" "Apache-HttpClient/4.5.2 (Java/1.8.0_161)"
[18/Apr/2020:18:11:09 +0200] "GET /?author=8 HTTP/1.1" 404 10774 "-" "Apache-HttpClient/4.5.2 (Java/1.8.0_161)"
Code language: JSON / JSON with Comments (json)
This is a common problem these days and unless you block all these requests (which you effectively can’t, since they’re too many), you should focus on the real error messages that are actual problems on your website.
Conclusion
Even if you can’t remove every error – you can, and should, have at least an eye on it. Only this way you can make sure that everything on your website works as expected. And a positive effect is a better performance, user experience and a stop in waisting resources – both on server and user side.