December 31, 2019

Moving Ghost (Pro) to subfolder - and failing to

Mathias458

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! 🎉

Loading comments...