Site Tweaks

An Eccentric Anomaly: Ed Davies's Blog

I've just made a couple of tweaks to the way in which this site is served. They shouldn't have any harmful effects but if you notice anything wrong I'd be grateful if you could let me know.

In case it's of any interest to anybody the two changes are:

I've been something of a fan of IPv6 since it was first widely discussed twenty years or so ago but have never had an chance to play with it since - the whole process of its introduction has been stunningly slow - so when a brief Twitter conversation led to my hosting provider (Mythic Beasts) adding IPv6 support fully on the server hosting this site (Sphinx) I had to get around to trying it after a quick support email exchange to get the details.

Apparently, Sphinx runs two versions of Apache: 1.3.37 which was what was serving my relatively old site there and 2.2.22 for newer sites. They distinguish them by IP address so you switch by changing the DNS settings for your domain and IPv6 is only available on the Apache 2 profile so I needed to change.

Actually, the switch to Apache 2 seems harmless and had a tiny beneficial effect. The “www.” bit that people insist on putting on the front of web site domain names irritates me: it's almost always entirely pointless as they usually serve the site from the bare domain name as well. For this reason I chose to get rid of it wherever possible having a little stanza in my .htaccess file to tell Apache to redirect (301 Moved Permanently) any www.edavies.me.uk URL to the equivalent edavies.me.uk one.

Apache (at least as set up on Sphinx) does a similar thing to add a trailing slash when you try to access a directory without one. E.g. an access to http://edavies.me.uk/blog 301 redirects to http://edavies.me.uk/blog/. Unfortunately, the Apache 1 set up also added a leading “www.” which my .htaccess stanza then removed by a second redirect which was a bit silly. Their Apache 2 doesn't seem to add the “www.” which saves a round trip.

I also rather like documents to be well-formed XML (e.g., XHTML) rather than messy HTML with missing end element tags where you have to hope the browser will make the same imaginative guess as you where they should be inserted. Accordingly, I have code to automatically check that all .html, .xml, .svg and so on files on the site (apart from some old .html and even .htm ones) are well-formed XML before upload to the server. For the last few years all the web pages I've created have been formatted internally as XHTML.

Unfortunately, they're still actually served as text/html rather than application/xhtml+xml. This is mostly because I haven't got round to updating the old pages and/or splitting off the old ones with suitable .htaccess files.

The other day this caused me a little grief as my first version of my previous blog entry had inline SVG which didn't work in the quirks mode that browsers render text/html documents in without a suitable doctype declaration.

Accordingly, I've got rid of the XML declaration at the front of the generated (blog) pages and added a rather minimal HTML5-style <DOCTYPE html> declaration so now they're rendered in standards mode.

As I get round to it I'll change other pages (e.g., my homepage) to this style. I also need to sort out a couple of the old EW Avionics pages which are actually in the ISO 8859-1 character set (and say so in their headers) but are served as charset=utf-8 in the HTTP headers (which takes precedence) resulting in accented letters and degree symbols looking wrong. [Update: character set stuff fixed 2015-11-28, I hope.]

As I say, if you notice anything else wrong I'd be pleased if you could let me know.

[Update 2016-03-10: Mythic Beasts have changed the way the server for this site is configured (changes towards allowing https for sites like this - something I look forward to) which interacted very badly with my “www.” redirections mentioned above forming a redirection loop leaving the site broken for a couple of days while I was away. They've been very helpful in fixing it promptly so that I can now get rid of all that guff and things should be working fine on the bare domain and redirecting automatically from www.edavies.me.uk to edavies.me.uk now.]