DNS records for my-domain.com/static/what/ever

I want everything under the /static/ prefix to point to a WP server hosted elsewhere, i.e.

  1. my-domain dot com/static/foo
  2. my-domain dot com/static/bar
  3. my-domain dot com/static/baz

But anything that’s NOT under /static/, to point to a Cloudflare page React SPA, which is what I currently have, i.e.

  1. my-domain dot com
  2. my-domain dot com/what/ever

how do I do that?

What’s important here is that the path pointing to the WP site is preserved, i.e. /static/foo and /static/bar will point /foo and /bar respectively in the WP site

With page rules I couldn’t find how to do that since there’s no option to point to an IP there, only url forwarding which is not what I want

you can do it if you own both servers, on second server put an addon domain then use a page rule to point that addon domain. If you don’t have a spare domain, you can set a subdomain on the second server with root on /static folder, then with page rule, point to the subdomain

server 1
my-domain dot com

server 2
static.my-domain dot com with root folder on static

page rule
my-domain dot com/static/* → static.my-domain dot com/*

Thanks Fernando.

I’ve currently achieved this with a worker script. Do you see any advantages in your approach over this?

I also (think) I need the worker because I need to format the links from the WP site, i.e. WP thinks the url is sub dot domain dot com when in reality it’s domain dot com/he

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.