- 2024
- Jul
- 26
Creating a useful 404 page for this blog (and flatpress in general?)
When I was setting up redirects and closing pygg.xyz for the last time, I toyed with a bunch of ideas about how to properly tell the viewer that they had either reached their destination, or that the link they had was no longer valid. If someone had a link that wasn’t valid, I could simply let it go to the host’s 404 page - that’s not useful to the viewer, however.
The first option I tried was creating a simple 404 page with some information and links. That’s fine, but it’s just not the best looking thing in the world. I quickly abandoned that for a page at the end of the blog, “posted” long before any of the real posts were made. This worked, but…
Anyone that has a website of any sort knows that you’re going to get slammed by bad actors looking for entry points. In this case, those bad actors assume that since it’s a “blog,” you’re running WordPress. According to the site logs, I was getting slammed by requests for things in associated directories. There were quite a few other things as well. SQL, Oracle, SAP…all of those were common things being probed. There were even a lot of things I didn’t know what they were until I looked them up.
I set up the page at the end of the blog and checked back the next day. Exactly what you’d think happened, did. Hundreds of “views” in 24 hours, and I can guarantee you that none of those were actual people looking at that page. The view counter slowly went up with each refresh, indicating that the attacks were continuous.
This isn’t necessarily a problem, but it is in a way. If I were to let that page sit there, the site statistics would eventually show that page as being the most popular one on the blog - it would literally dwarf all other posts because it was getting hundreds of “views” a day. I didn’t want that, I want to give you things you’re interested in seeing. An error page isn’t interesting when you’re browsing the popular posts page.
I settled on a compromise. I took a static snapshot of the 404 page from “View Source,” cleaned it up to remove anything that’s not going to update, and made it the “Not Found” page. It looks almost like a blog page and has all of the sidebar widgets for navigation. This gives the viewer plenty of explanation as to why they are there, and what is available to them if they want to continue. This seems like the best choice - I’m not polluting the site with fake views, and a viewer who arrives there by accident has plenty of ways to find other content while landing on a familiar looking page.
Of course, as I read that page, it will change. Some of the things I write just don’t make any sense, and as I run across other situations those need to be addressed. In all, I think it’s a good place to land if someone does happen to find a broken link.
Maybe I’ll sit down sometime and analyze the WordPress script kiddies’ requests and create a special page for them that sends them to some weird government org. Probably not, they can sit on the 404 page just like everyone else.