Recovering visitors from my old wordpress blog

This is a sort of meta-question, and maybe it should be asked elsewhere. Since moving from wordpress to Hugo, I’ve also changed the site URL. Initially it was simply https://numbersandshapes.net; now it’s https://blog.numbersandshapes.net. The original URL returns a “404 page not found” error. In fact, there’s really no way to get to my hugo site unless you know where it is. This means that currently I’m writing for an audience of one (me), which is stupid.

I’m wondering if I should set up some sort of site redirect, or maybe a nice homepage which includes a link to the blog… how do folk here manage? How do you encourage people to visit your site? Note that back in my old wordpress days I had something like 250,000 visitors; it’d be nice to see them again!

Hi there – where are you hosting your site?

You could setup a 301 redirect, which would redirect visitors from your old URL to your new one.

How you do this depends on where you’re hosting as @zwbetz says above, or more specifically, what web server the host is using. You can easily make a simple Hugo site to host on your bare domain which has a link, if you like that style (might be good because you can tell people on the top page to re-bookmark), or, if you’re using Apache for instance, you could just host an .htaccess file in the root of that bare domain site to do the 301 redirect automatically.

I keep a .htaccess file with redirects inside for the URLs that changed since I moved my blog a few times over the 10+ years I’m running it. It’s not just your existing visitors you’re losing, but also Google and the hard-won search ranking you had.

If you’re on Apache – which is the most common web server – then you’ll want to use its RedirectMatch directive:

RedirectMatch permanent "(.*)" "https://blog.numbersandshapes.net/$1"

The permanent bit tells all clients (most importantly, Google) that the URL changed permanently and everyone should update their indexes and bookmarks.

I would also go through the rest of your content and see what other URLs might have changed. Your 404 error log will be of help – see what pages trigger the errors. Sometimes and old engine will use and underscore _ in a URL where Hugo will use a dash - etc. Then add more Redirect and RedirectMatch rules to your .htaccess.

If you need more complex rules, ie. parsing a query string, then you’ll need to use mod_rewrite, for which Apache has a convenient guide.

2 Likes