After launching my new blog - built with the Roda framework - I was pretty chuffed with how things turned out. Sure, there’s still a few minor niggles, but for the most part, everything is working well.
Then a couple of weeks back an issue turned up on Google groups about how Roda was returning a 404 on empty responses. This got me thinking on what the headers of my site look like, so I booted up the terminal and made a
$ curl -I http://mrcook.uk
The response included these two lines;
HTTP/1.1 404 Not Found ... Status: 404 Not Found
That was a surprise, although it turns out this is actually correct Roda behaviour.
Roda is a framework, but unlike Ruby on Rails, it let’s you have full control over how you build your app, and that includes how the headers are configured. Fair enough, but for public facing websites, having the headers return a 404 status is probably not a good idea.
At the end of the noughties, I worked for a German online marketing firm and during that time I learned a lot about SEO. These days, off-site SEO strategies are probably more important, but we still need to put some consideration into how Google and other Search Engines (SE’s) see our site; good title tags, proper use of h-tags (especially h1 tag), fast page load times, among other things. Sites that produce a lot of
404 errors, even if only in the headers, are not good.
Search Engines and other bots may send a HEAD request prior to crawling a particular page (then using a normal a GET request). By default, Roda HEAD requests will return a 404 status, which may possibly prevent SE’s from crawling your website at all, and if the SE’s don’t index your site then your pages will never show in Google searches - very bad!
Thankfully, the Roda framework makes it easy for us to fix this by providing the
In your main app file add the following;
That’s it! Now you can continue on your merry web-development way, safe in the knowledge that SE’s will at least crawl your site…now it’s up to you to make sure you have good SEO too!