# Does redirects.json work with Ghost REST API?

**URL:** <https://forum.ghost.org/t/does-redirects-json-work-with-ghost-rest-api/2323>\
**Category:** Developer help\
**Created:** [August 8, 2018, 5:59pm UTC](https://forum.ghost.org/t/does-redirects-json-work-with-ghost-rest-api/2323 "2018-08-08T17:59:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbrichards](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/sbrichards/32/726_2.png) [@sbrichards](https://forum.ghost.org/u/sbrichards)\
**Post date:** [August 8, 2018, 5:59pm UTC](https://forum.ghost.org/t/does-redirects-json-work-with-ghost-rest-api/2323/1 "2018-08-08T17:59:32Z")

</div>

I’m looking into setting up redirects using the redirects.json feature:  
[https://docs.ghost.org/v1/docs/redirects](https://docs.ghost.org/v1/docs/redirects)

Tested around but could not get it working. Should I expect the API request URL to redirect? Or does this feature only work when using a Ghost template vs. the REST API?

Here’s my redirects.json:

```auto
[
    {
        "from": "the-future-of-public-finance-is-coming",
        "to": "lets-restart-the-hidden-economic-engine",
        "permanent": true
    }
]

```

Requesting this URL in a browser:  
[https://neighborly.com/learn/the-future-of-public-finance-is-coming](https://neighborly.com/learn/the-future-of-public-finance-is-coming)

Still yields the following API request, which 404s:  
[https://neighborly.com/learn/ghost/api/v0.1/posts/slug/the-future-of-public-finance-is-coming/?...client\_secret\_info](https://neighborly.com/learn/ghost/api/v0.1/posts/slug/the-future-of-public-finance-is-coming/?...client_secret_info)

Ideal scenario would be to redirect the browser to the new page:

> **[Find Home Services Experts in Your Town, For Free | Neighborly](https://www.neighborly.com)**
>
> Find and hire locally-owned home services experts whose work is trusted by homeowners and business owners in your neighborhood. It’s easy with Neighborly.

Less ideal but workable scenario would be that the API request redirects the slug:  
[https://neighborly.com/learn/ghost/api/v0.1/posts/slug/lets-restart-the-hidden-economic-engine/?...client\_secret\_info](https://neighborly.com/learn/ghost/api/v0.1/posts/slug/lets-restart-the-hidden-economic-engine/?...client_secret_info)

Thanks!

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [August 8, 2018, 6:11pm UTC](https://forum.ghost.org/t/does-redirects-json-work-with-ghost-rest-api/2323/2 "2018-08-08T18:11:03Z")

</div>

Ghost’s redirects.json does not affect the API at all, it only deals with URLs (not slugs) and will redirect a request coming in to the front-end not the API.

Eg. redirects.json:

```json
[
    {
       "from": "/old-post/",
       "to": "/new-post/",
       "permanent": true
    }
]

```

[myblog.com/old-post/](http://myblog.com/old-post/) → (301) → [myblog.com/new-post/](http://myblog.com/new-post/)

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [August 8, 2018, 6:12pm UTC](https://forum.ghost.org/t/does-redirects-json-work-with-ghost-rest-api/2323/3 "2018-08-08T18:12:46Z")

</div>

The docs cover typical use-cases:

[https://docs.ghost.org/docs/redirects](https://docs.ghost.org/docs/redirects)

---

<div class="post-metadata">

**Author:** ![sbrichards](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/sbrichards/32/726_2.png) [@sbrichards](https://forum.ghost.org/u/sbrichards)\
**Post date:** [August 8, 2018, 7:59pm UTC](https://forum.ghost.org/t/does-redirects-json-work-with-ghost-rest-api/2323/4 "2018-08-08T19:59:42Z")

</div>

Ah, bummer. Thanks @Kevin. Given that redirects.json does not affect the API at all, I’ll solve this with NGINX.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/b/ba9ce5100b8bb264586f4f572545596b2ce3f081.png) [@system](https://forum.ghost.org/u/system)\
**Post date:** [August 22, 2018, 7:59pm UTC](https://forum.ghost.org/t/does-redirects-json-work-with-ghost-rest-api/2323/5 "2018-08-22T19:59:42Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
