Changing the base_url for posts / Headless CRM

I’ve got ghost working as a headless backend for a next.js site. I’m trying to figure out how to change the “base url” that Ghost uses when return post URLs in the Content API. I tried setting the url field in config, but it seems like that has to match the domain ghost itself is running on, otherwise routing fails (cannot get /).Anybody solve this one? I can replace the ghost domain in my API layer, but prefer that it would show the actual URL in ghost admin frontend as well.

Hey @lasersox :wave:

If I’m understanding you correctly, you have Ghost running on a domain (e.g., and you have a next site (e.g., and you’re having issues with the base url being instead of The fix for this is to set the Admin URL to, and the url to Here are the docs for setting the url and the admin url:

Thanks for your reply! You are correct. I’ve tried as you suggest, but it always gives me a “cannot get /” error when loading the page. Perhaps because I have added a subpath on the url, eg,

If you check our our Eleventy starter you’ll see that I’m swapping out the Ghost URL for a relative path. I’ve found it to be the best way to get a bit more control, and to not cross wires with the Ghost installation:

Thanks David, that makes sense, this will work on the frontend side. I can train the editor / authors how to find the link to their post. Can you verify that it’s not possible to do this on the Ghost side? Would Ghost team be open to this feature? Perhaps I can contribute something?

You could make use of the redirects feature, or use JavaScript, on the Ghost site to redirect links to the Next.js app?

To answer this question specifically if anyone else runs into this, if you set ghost up in a subdirectory, the admin url will also only work in the subdirectory - so - “published” site - Admin interface

1 Like

I will try it. Thanks for the help!

1 Like