Docs/Subfolder hosting

Subfolder via Cloudflare

A tiny Worker serves the blog at example.com/blog — and it's the route for Webflow, Framer, Shopify, Squarespace, and WordPress.com, which can't proxy on their own.

If your domain runs through Cloudflare (orange-cloud DNS), you can mount the blog at /blog no matter what hosts the rest of the site. First enable Settings → Subfolder hosting in the dashboard, then create this Worker.

worker.jsexport default { async fetch(request) { const url = new URL(request.url); if (url.pathname === "/blog/") { return Response.redirect(url.origin + "/blog", 301); } if (url.pathname === "/blog" || url.pathname.startsWith("/blog/")) { const path = url.pathname === "/blog" ? "/" : url.pathname.slice(5); return fetch("https://you.blogcms.app/_subfolder" + path + url.search); } return fetch(request); // everything else: untouched }, };
  • In the Cloudflare dashboard: Workers & Pages → create the Worker, then add a route for example.com/blog* pointing at it.
  • Works in front of Webflow, Framer, Shopify, Squarespace, WordPress — no changes inside the builder.
  • Publish the blog once, then hit Verify setup in Settings → Subfolder hosting.