How I moved my Ghost blog to a new domain
This blog used to be hosted on another domain (itsybitsybytes.com), until I decided it was a better move to have it as a subdomain of my personal homepage: programming.bogdanbucur.eu
All it took was half a day, a lot of googlin' and three big steps.
1. Set up Ghost on the new domain
Since the old blog was using an obsolete version of Ghost and I didn't care in particular for anything else but the content, I took the easy way out and simply installed a new Ghost blog.
The new install process (Ghost 4.0, for those reading this in the future) was amazingly simple. It took care everything, including setting up the domain and SSL for the domain. All I had to do was to import the posts from the old site. Even though it came from a Ghost 2.0 blog, there were no problems there.
However,** there was one extra step I did before importing the json backup**. Some of the posts used to have hardcoded references to the old domain. My fix was simple: open the json file inside a text editor and do a simple replace: from
For the images there is no restore inside the CMS (as far as I know), so I did it the old fashioned way: uploaded everything that was insides the
content/images folder on the previous blog to the new
You might run into some permission problems because of this trick, so make sure to run the following commands after you are finished:
sudo chmod 775 /var/www/sitename/content/images
sudo chown -R ghost:ghost /var/www/sitename/content/images
where the path
/var/www/sitename/content/images depends on your installation, of course. The Ghost forum takes credit for the last one.
With the new blog up and running, it was time to sunset the old one.
2. Redirect all requests to the new domain
I once again turned to Google for help and ended up on this Ghost forum topic: Change name and domain of the blog
There is no setting inside of Ghost for this sort of redirect, but it can be fixed with a simple nginx rule.
return 301 https://yournewdomain.tld$request_uri;
You need to insert it inside the
location block, after commenting or deleting the old reverse proxy code.
This one line of code is all you need, assuming nothing else changes with the URL structure. All that's left to do is preserve any love you might have from the search engines.
3. Let Google know
In theory, the 301 redirect should be enough for the SEO part. However, for Google, the big one, there is one extra step you could take to make the transition more fluid.
Just read the info on the Search Console help page for the Change Address Tool. After you're ready, head on up to the Change Address Tool itself and start the process.
And that was it! You might not teach an old dog new tricks but you sure can give an old blog a new domain!