Does anyone know how to set up this URL redirect?

It works perfectly on GoogleDomains and Porkbun. But I can’t figure out how to make it work on Cloudflare.

I need the following:

example.com/[wildcard-word]

to be forwarded to

new-example.com/#welcome/[the-same-wildcard-word]



So far, using Cloudflare Rules, I can achieve the following:

example.com/[wildcard-word]
new-example.com/[the-same-wildcard-word]#welcome

As you can see, Cloudflare puts the hashtag-word AFTER the wildcard-word. I need it to be BEFORE the wildcard-word.

Again, it works perfectly on GoogleDomains and Porkbun. Any idea how to do it on Cloudflare?

Any help would be greatly appreciated. Thank you.

Have you tried URL encoding your octothorpe? Normally a # followed by an anchor ID would be placed at the end of the URI to load an anchor on the page. It may be that in order to place one where you want, you need to write it as %23welcome instead of #welcome.

I don’t know if that is the answer or not, as I have never had the need for a rewrite that included an octothorpe. I just wanted to offer you a possibility to test.

1 Like

Thank you for the suggestion, but it didn’t fully solve the issue.

1 Like

Finally, figured it out thanks to the Page Rules migration guide and some trial and error.

Anyway, for those very few who might want this kind of URL redirect, follow this guide here.

But instead of using:
equals for operator, and
www.example.com for value,

use this:
contains for operator, and
example.com for value.

This change will allow you to reach your target domain name with or without www or any other subdomain.

1 Like

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