Redirect a Custom URL to a New Domain URL

Hi Community !

Query : I own two domains example.com and another.com
I want that whenever a user tries to alter the URI of example.com :point_down:

Original : example.com/0:/test_page
User Modified : example.com/0:/ (Manually)

  1. Redirect to : another.com OR
  2. Redirect to : Initial URL :point_right: example.com/0:/test_page

I want solution of any above mentioned requirement whichever is possible.

After some googling I came to know that I should add Transform Rules, Also mentioned Paging Rules didn’t work and won’t fulfill the requirement. I request anyone who could please help me with this. :pray:

Are you saying that if the user tries to go to the /0:/ URL (which probably doesn’t exist, I guess), you want them redirected to /0:/test_page ?

No Sorry for misunderstanding
:0/ Is just page dont worrry about that.
The page example.com/0:/ is the default page of website which contains some private data , with users I share example.com/something/

The 1st URL which contains sensitive data I want that whenever user tries to alter the given URL they must get redirected to another domain which is owned by me lets says another.com/DoNotActSmart.html

Just a redirecting one particular URL of domain A to another new Domain. That’s it
I hope i was able to explain here. :))

Are you saying that you have to way to stop a user from changing the URL to view sensitive data?

There’s no technical way for a proxy to stop people from typing in random valid URLs.

No Brother, I just want that if anyone goes to this URL example.com/0:/ Then should just get Redirected to another.com/DoNotActSmart.html Domain
Only on the above specific URL rest no re-direction

Then a basic Page Rule should work:

Yes Brother I tried this, But don’t know why , This didn’t worked. :pray:

I had to put https:// in front of another.com to be able to save the Page Rule, but it does work. (of course I put my actual domain name into the Match field.

I did the same, Is it Allowed to share the Image with those URLs here ? If yes, I don’t have any problem in sharing the settings Screenshot

Go ahead. I block mine for privacy.

Thanks for Allowing, Here is the SS. Please refer to it :point_down:

Try opening this URL in browser in URL and you will see that redirection doesn’t work.

It’s not working for me, either.

Can you confirm that on the bottom of your DNS page, that Cloudflare as assigned the Leonidas and Sreeni name servers?

Have you tried any other types of Page Rules to see if they work?

Yes nameservers, are assigned Properly. Other types of Page Rules doesn’t fit my requirement. Though the URL Transform rules are working but they aren’t made specifically for URL Forwarding :worried:

I just wanted to see if Page Rules are working at all.

Are you using any Workers on your site?

Yes the domain on which we are trying it has JS Code on CF Workers

It’s quite possible that Workers is preventing the Page Rule from running. Other @MVP members might know how this works.

1 Like

Ooh I see, In the meantime community and I confirm this.
OFFTOPIC: Do you have any idea if I could add some JS Code in Script which does this thing of URL Redirection :thinking:

When I was trying out Workers Sites I did exactly that to perform redirects I could no longer do with page rules. Location replace() Method

2 Likes

Spottest onest.

2 Likes

Thanks for Support . I found the way , I had to just add few lines of JS Code in Worker and it Worked.