Current Alternative of page rules Deprecated

Hi All,

As Page rules is about to be deprecated soon, what will be current alternative of this on Cloudflare. Example: I need to route from https://www.example.com to https://www.example.com/foo/bar so how can I achieve this?

Kindly help me on this since we have multiple page rules & I need to migrate all of them one by one to another alternative.

Thanks

You would use a Redirect Rule. See this guide for examples. A link to complete documentation follows.

1 Like

Thanks for sharing this. I have tried this below but its not working for me. Kindly advise.

If you need further help with this, you’ll need to post a screenshot of the actual rule with the hostnames so we can see what you mean by “its not working”.

1 Like

Here is the screenshot of example

Hostname shouldn’t have a slash on the end.

2 Likes

Thanks a lot @sdayman , You made my day :grinning:

After removing /, Yes its working now

2 Likes

@sdayman I need one more help on below rule which is not working for me.

Are you saying you want to replace /talk/ with /foo/bar/ at the new hostname? (and keep the rest of the path after /talk/)

yes /talk/* rest of the path to /foo/bar/ with new hostname

It should look like this:

(oops…I typo’d the first hostname in the screenshot)

I didn’t notice the /device part of the path. So this will match your hostname, and path starting with /talk, then redirect to the new hostname with the new path starting with /device/foo/bar and removing the first five characters of the old path (/talk), but keeping the rest.

concat("https://www.tdcx.com/device/foo/bar",substring(http.request.uri.path,5))

Yes it worked @sdayman , Thanks for your help :blush:

2 Likes

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