A couple of years ago I wrote a blog post pondering why I have a web site. At that time I had a blog on Google’s “Blogger.com” platform and a hand-crafted web site hosted elsewhere. My hosting company had recently increased its prices a lot, which prompted me to ask why I have a web site at all.
Two years on and I’ve merged my blog and web site, and moved to a web and email hosting package from mythic beasts. I’m now using WordPress for both blog and web site. It’s much easier to use than my hand crafted HTML and there are loads of plugins available to add functionality.
I’ve done my best to redirect old links to my new site. Redirecting from Blogger.com was easier than I expected. Obviously Google don’t let you muck about with .htaccess
and the like, but you can edit the HTML of your chosen theme. I added the following at the start of the <head>
section:
<script type='text/javascript'>
location.hostname = 'jim-easterbrook.me.uk';
if (location.pathname == '/') {
location.pathname = '/blog/';
}
</script>
This redirects blog posts to my web site (and the blog front page to my site’s blog page), but doesn’t deal with any other changes in the URL. A typical Blogger.com URL is “https://jim-jotting.blogspot.com/2018/01/sussex-pond-pudding.html
“, but on WordPress it becomes “https://www.jim-easterbrook.me.uk/2018/01/sussex-pond-pudding/
“. Replacing the “.html
” with “/
” is done in the .htaccess
file on my site:
# Replace xx.html with xx/ or /index.html with /
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.*?)(/index)?\.html$ /$1/ [R=301,L]
This also converts URLs from my old web site structure.
One more wrinkle is that Blogger.com doesn’t include the words “the” and “a” in the “slug” it generates to construct a URL, but WordPress does. I could have changed the slugs on WordPress but instead I added a bunch of Redirect
rules to .htaccess
, for example:
Redirect 301 /2019/09/shaun-sheep/ /2019/09/shaun-the-sheep/
Note that these rules do not include “.html
” as that’s already been removed by the RewriteRule
that’s processed before the Redirect
rules.
I’ll be monitoring my site’s access logs over the next few days to see if any further changes are needed, but it all seems to be working OK so far.