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.

 



Was this article helpful?
Thanks!

Your feedback helps us improve Allwebtuts.com