3
3 Comments

Moving Ghost (Pro) to subfolder - and failing to

Ghost Pro is the managed Ghost CMS for blogs that takes cares of maintenance and updates. The limitation is that Ghost is hosted on a separate subdomain, which means it doesn't share any domain authority with your main site.

So we tried to move it to a subfolder and stay on Ghost Pro... And failed.

Here's what we did:

We found this Cloudflare article describing how it could be done using Cloudflare Edge Workers:
https://blog.cloudflare.com/subdomains-vs-subdirectories-improved-seo-part-2/
We're using Cloudflare, so we thought we were all set!

Problem 1: The script provided doesn't work out of the box.
So we altered it to make it work.

Problem 2: CSS and images wouldn't load and internal links were wrong.
So we uploaded a new Ghost yaml file with new routes.
More info here: https://forum.ghost.org/t/clarifying-custom-home-page-routing/2613/2
And updated our Edge worker to detect the new prefixes in the URLs and rewrite them.

Images and urls worked.

Everything seemed fine.

So we tried to use Cloudflare to redirect our .blog subdomain to /blog/ subfolder. And that didn't work.

Cloudflare detects if you are adding a Ghost Pro CNAME and locks you out of the controls for this subdomain. The Ghost team has an Enterprise plan with Cloudflare and part of the deal is that Ghost manages your Cloudflare settings.

We tried using the standard Page rules, they were ignored, we tried using Edge Workers, but that didn't work either.

Well to be fair, that's not the only problem we encountered:

  1. Our internal Ghost search results was throwing up links to our .blog subdomain and not /blog/ folder.
  2. The meta tag rel="canonical" which Ghost adds to every page in the <head> of every page still linked to the .blog subdomain and not /blog/
  3. All links of the auto-generated sitemap.xml link to .blog subdomain and not /blog/

Lessons learned and hopefully this is a warning to people trying the same thing.

Happy new year guys! 🎉

  1. 1

    This is insaaaaaane. I am looking to start a simple blog for Cloakist and want it at /blog instead of blog. for SEO reasons. Your article has served as a great warning. What did you end up doing instead?

    1. 1

      Solved this 4 months later with a Cloudflare Edge worker Reverse Proxy to self-hosted Ghost CMS on OceanDigital droplet. More info here: https://www.indiehackers.com/product/img-vision/ghost-blog-is-now-hosted-on-main-domain--M6Gt3CSAp3nIFeZKOC-

      1. 1

        Awesome - thanks a lot for letting me know. I can see myself doing this in the future.

Trending on Indie Hackers
I talked to 8 SaaS founders, these are the most common SaaS tools they use 20 comments What are your cold outreach conversion rates? Top 3 Metrics And Benchmarks To Track 19 comments How I Sourced 60% of Customers From Linkedin, Organically 12 comments Hero Section Copywriting Framework that Converts 3x 12 comments Promptzone - first-of-its-kind social media platform dedicated to all things AI. 8 comments How to create a rating system with Tailwind CSS and Alpinejs 7 comments