Redirect with dynamic links

I am trying to do redirection on my Ghost website to a sub-domain of my website which has another application hosted there,

I am having the below redirect code on Ghost:

{
    "from": "^\\/game(\\/?)$",
    "to": "https://mydomain.com/room/?/",
    "permanent": false
},

Expected:
When I go to https://myghost.com/game/12345678,
I will be redirected to https://mydomain.com/room/12345678

Now:
When I go to https://myghost.com/game/12345678,
it will go to a 404 page.
But when I go to https://myghost.com/game/#/12345678,
I will be redirected to https://mydomain.com/room/#/12345678

Is there something wrong on the redirection code above ?

  • Ghost version 3.41.9

Thank you!

1 Like

Try this:

    {
        "from": "/game/(.*)",
        "to": "https://your.awesome.domain/room/$1"
    }

Couple of resources as well:

  • Docs
  • redirects.json from the Ghost tests
1 Like

Thank you so much. It works perfectly now.

1 Like