In the event that you accidentally publish a Ghost post with an incorrect URL slug, or you want to point a particular page on your site to another place, you may need to configure a redirect on your site. Luckily, Ghost makes it easy to configure those redirects.
To start, go into your Ghost admin dashboard, and then navigate to Settings. You can find the Settings page by using the gear icon at the bottom of the left-hand navigation pane:
Inside Settings, click the the Labs section:
Inside Labs, there's a section called Beta Features, which contains a feature called Redirects. Use the Download current redirects button in order to download a YAML file containing all the currently existing redirects. Alternatively, if you haven't configured any redirects yet, you can create a new file called
redirects.yaml, your file will start with the line
301:. Each line after that will list the URL slug that you want to redirect, followed by the slug for the page you want it to redirect to. For example, imagine that you published a post with a particular URL slug, and then later decided to go back and change it. You can now point the old URL slug to the new location, and it will look something like this:
Based on the above example, if the full URL is myghost.site/url-slug-that-needs-changing, now visitors going to that page will be redirected to myghost.site/new-url-slug instead.
Say that after that, you decide that you also want to point the slug for a particular page to a different page. You would add another line with the next redirect, but wouldn't repeat the
301:. The end result will look like this:
Once you have everything configured the way you want it, you can return to the Redirects section and use click the Upload redirects YAML/JSON button to upload your file.
If in the future you decide you want to add more redirects or change the ones you already have in place, the process is the same: you can download that file again, edit it how you want, and re-upload it.