Custom domain for website hosted on a subfolder

So I have a need for pointing a customer’s domain to a website hosted on Cloudflare domain

The customer’s domain is of the form while the domain on Cloudflare is of the form So I want to be pointing to a subfolder

I’m aware of Cloudflare for SaaS but couldn’t find a solution for this use case. Could I know how it could be routed this way?

Hi there, thanks for your questions!

After adding the custom domain with Cloudflare for SaaS if needed, you can use Transform Rules to achieve this:

You need to create a new URL rewrite rule:

Add the hostname as a filter:

And then set a dynamic rewrite to concat("/example", http.request.uri.path)

Let us know if you have any questions :slightly_smiling_face:

Hi. So in this case will it append the path to the custom domain entered by the user?

And also how could this be done via API once the custom domain is created on Cloudflare?

Hi again!

It will append the path to the domain in the request sent to your origin server. So when the user visits Cloudflare will send a request to

This should help:

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