How to create a redirect to another domain using redirects.json on Ghost blog

You can use both YAML and JSON for creating redirects. In this post I use JSON but you can easily translate my examples to YAML. Redirects for other domains are useful for migrations or if you have several domains.

First step is to download your current list of redirects. You do this by going to the labs section of your Ghost back office and scroll to the bottom:

Ghost-blog-redirect-file-location

Here you will be able to do two things: download your current redirects.json file and upload a new one. To add a redirect you need to download the redirect file, which will look something like the following when you open it:

 []

From here you can add the redirects you want on your blog. In order to create a redirect to another domain add it in the "to" part of the JSON:

[
 {
   "from": "/test-redirect-to-google",
   "to": "https://www.google.com",
   "permanent": false
 }
]

In the above I redirect from https://peterdaugaardrasmussen.com/test-redirect-to-google to https://www.google.com. After making the necessary changes you need to upload the changed redirects.json file the same place where you downloaded it. That is all there is to it.

Want to make redirects just within your Ghost blog? See my other post on how to do this. I hope you found this helpful, please leave a comment down below!