How to Create a 301 Post redirect in Ghost

How to Create a 301 Post redirect in Ghost


In this tutorial, we are going to see the method to Create a 301 Post redirect in Ghost.
Ghost having built-in redirection feature you can see this option on your ghost admin dashboard lab section.
One of the Best Feature from Ghost CMS 🙂 No need to touch the Nginx Host file for add Redirection codes.you can do anything from the Ghost redirects.
it having a lot of Redirects option here is the official docs – https://docs.ghost.org/v1/docs/redirects

CREATE A 301 POST REDIRECT IN GHOST

  • Login to your Ghost admin dashboard
  • Goto labs
  • you can find the Redirects option on Labs
Create a 301 Post redirect in Ghost
  • Download current redirects file (redirects.json)
  • by default, it is an Empty JSON File
  • Open this file in any Code editors
  • Now I am going to Create a 301 Post redirection
{
 "permanent": true,
 "from": "/best-cryptocurrency-to-invest/",
 "to": "/"
 }
  • that above code for redirect deleted post into the Homepage
“permanent”: true, – Permanent 301 redirects
from – Add your old post URL or deleted post URL
to – Add your New post URL or Homepage URL use / for homepage redirection

EXAMPLE

{
 "permanent": true,
 "from": "/my-old-blog-post/",
 "to": "/new-updated-blog-post/"
 }
  • Here is My Full code
redirects.json
[

{
 "permanent": true,
 "from": "/best-cryptocurrency-to-invest/",
 "to": "/"
 }
]
  • Upload the Redirects JSON file from your Ghost Admin Dashboard (we can find the redirects.json file on content/data/redirects.json)
  • cURL Verify
Create a 301 Post redirect in Ghost
  • That’s all Successfully we create a 301 Post Redirection in Ghost

FROM THE EDITOR’S DESK

Before Uploading your redirects File validate your JSON codes in offline or online tools like JSONLINT.

Comments