Redirect to subfolder on an another system

Hello,

I’ve a little problem where I do not know what to do.

Currently we are using our domain (let it be www. example. com) with Cloudflare Loadbalancer with URLs like
www. example. com/men/shirts/
fr. example. com/homme/shirts/

Now, we want to redirect these like this:
www. example. com/men/shirts/ ==> www. example. com/en/men/shirts/
fr. example. com/homme/shirts/ ==> www. example. com/fr/homme/shirts/

Normally, I would do this with Page Rules. But there is a problem. The new destination is on a whole other system, which is hosted by a provider, which is also using Cloudflare. So it means that

www. example. com/ whould be our system
www. example. com/xx/ would be another system from another cloudflare account (xx=multiple languages)

In the end the new provider will be the new hoster for all our services.

How can we do that?
Should we transfer the whole domain (www. example. com) to the new provider and let them handle all redirects and delete this from our account?

This doesn’t make sense, as the new destination uses the same domain as the original URL. You’re just redirecting to a folder in the same domain.

Since your example hides useful information, the page rule would be something like:

  1. Match www.example.com/men/* and forward to https://www.example.com/en/men/$1
  2. Match fr.example.com/* and forward to https://www.example.com/fr/$1

But I bet you’re going to run out of Page Rules, so this forwarding is best done on the site itself.

1 Like

I also think, that this makes no sense, but my CEO want to use the new provider with the old domainnames on the new URL structure and switch language for language to test. I’m sure, there is no possible solution for this.
Currently I only got a CNAME for the new production system, but if I use this for Page Rules, this would also be seen in the browser URL row, so I think, this is not a solution.
So far I have came to the conclusion, that we need to remove our domain from our Cloudflare account and the new hoster must add it to his account and then add SSL certificate and the Page Rules by himself. This would work, but only with a (short) downtime. Am I correct?

He is likely referring to “Masking”. If you want to point just a subdirectory to another provider, that is usually done on your server by proxying this directory to the new hosting.

Also, if you’re using a new hosting provider, you might not want to give them access to your domain configuration, except you want them to manage your whole domain. Otherwise, just point some subdomains to their IP addresses.

Best

1 Like

If we change our setup from LB www… to the CNAME of the new hosting provider, do we also have to set the Page Rules or does the new hosting provider has to set the Page Rules in his account by himself? I think, he must do it, right?

Generally, with few exceptions, you’ll keep your page rules working & active as long as the DNS record in Cloudflare is orange-clouded (:norange: Proxied) and as long as your domain’s name servers are pointing to Cloudflare. If you just change the value of the DNS record, all your page rules should remain as before.

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