Forwarding subdomain to an external folder

My main website is hosted in hosting server 1 : https://domain.com

Now I’d like to auto-forward https://abc.domain.com to hosting provider 2 with address xxx.xxx.xxx.xxx/abc

Please tell me how I can do this.

You just create an “A” record for abc at whichever IP address you want. This will form a subdomain for you to use abc.domain.com.

Thanks, I’ve done that and it points to the root folder. I’d like it to point to the folder “/abc”.

Okay, a bit of a different step and imo more annoying to do, but ideal if you want optional www. in your domain names.

  1. Create a CNAME record: Add a CNAME record for abc pointing to the IP address of hosting provider 2. This would look like:
  • Type: CNAME
  • Name: abc
  • Value: xxx.xxx.xxx.xxx/abc (Note: Ensure the format is correct for Cloudflare)
  1. Set up Page Rules: To auto-forward https://abc.domain.com to the specified hosting provider 2, you’ll need to create a page rule.
  • Go to the Page Rules section in Cloudflare.
  • Create a rule for https://abc.domain.com/* and set up a Forwarding URL action to https://xxx.xxx.xxx.xxx/abc/$1.

It’s just simple forwarding but note without the page rule, you cannot go to

https://abc.domain.com/hello-world/

I tried creating CNAME with name abc and placed value xxx.xxx.xxx.xxx/abc but CF says this error msg: “Content for CNAME record is invalid. (Code: 9007)”

Should I do step 2 even if step 1 is flagged with an error message?

No, in your case you’d just want an “A” record “abc” that points to the xxx.xxx.xxx.xxx IP. You’d have to construct the server to use /abc some how depending on the framework/language.

Ok. I created the A record that points to xxx.xxx.xxx.xxx IP. But I could not add the /abc in the end because it still flags it as an error. IPV4 shouldn’t have folders in the end.

Yeah it shouldn’t only a URL should had justified. Why is it that you need to access the service this way as this is not correct way; why not the direct IP?