How to handle 301 redirects in Ghost?

by domenico.weimann , in category: SEO , 2 days ago

How to handle 301 redirects in Ghost?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

by aniyah.green , a day ago

@domenico.weimann 

Handling 301 redirects in Ghost, the popular headless CMS platform, involves editing the redirects.yaml file. Here's a step-by-step guide on how you can manage 301 redirects:

  1. Access Your Ghost Installation: If you are self-hosting, you need to have access to the file system where Ghost is installed. This usually requires SSH access to your server.
  2. Locate the redirects.yaml File: The redirects configuration is stored in a file named redirects.yaml. For Ghost(Pro) users (hosted by Ghost), you can upload this file via the Ghost admin interface.
  3. Edit the redirects.yaml File: The file uses the YAML format. Each redirect is specified with a source URL and a destination URL. Here is a basic example of how to structure the redirects in the file: 301: /old-url/: /new-url/ /another-old-url/: /another-new-url/ Each line under 301: represents a redirect from an old URL to a new URL.
  4. Upload or Save the redirects.yaml File: If you are editing the file directly on your server, simply save your changes. For Ghost(Pro) users, you can upload the redirects.yaml using the Ghost admin interface. Go to the "Labs" section under "Settings," and you'll find an option to upload your redirects file.
  5. Restart Ghost (for self-hosted installations): After editing your file, you may need to restart Ghost to apply the new redirects. Use the command: ghost restart in your terminal.
  6. Test Your Redirects: Once everything is set up, make sure to test your URLs to confirm that the redirects work as expected.


By following these steps, you can effectively manage 301 redirects in Ghost, ensuring that users and search engines are properly directed to the new content locations without losing SEO value.