Serving WP blog hosted site as subfolder on main site using Workers

We’re looking to integrate a external WP blog site (blog.site.com) into our main site under a site.com/blog folder. can anyone provide a Worker script template that works with WP site?

Btw, we did look at Cloudflare SEO blog post 2 on Workers, but didn’t look ready for WP. Would be great if anyone had a similar script for a WP subdomain.

Thanks!

You can export a static version of your Wordpress and deploy it via a worker. Otherwise, you can proxy all requests directed to a specified route to a different origin in bulk or simply respond with another site.

Is there any specific challenge that you are facing?

4 Likes

Hey, we’re building a new WP blog site to replace the one we have on ‘/blog’, and for various reasons it needs to be hosted on different server/CDN/hosting service, but we want to avoid problems with SEO, so decided not to use subdomain or simple forwarders. The before mentioned article mention how to integrate a Ghost blog using Workers, but we’re looking to integrate a WP site under '/blog/. So wanted to hear if any tried that and could suggest a solution.

1 Like

If I was in your shoes, I would install the Wordpress in a subfolder called /blog and then use a “Resolve Override” page rule. This needs an Enterprise Plan however, so might not be an option.

Failing that, there was a series on the Cloudflare Blog discussing your exact requirement, so it’s a good place to start.

Thanks Michael, that’s the blog I was referring to. I understand most of the script, not sure what to do with assets when dealing with WP. They can be in many places in WP folder and below. Was think just to setting the assetsPathnames to ‘/’ or ‘/wp-content’