Can I use RegExp in Page Rules?

In the Page Rules section:

image

I want to match all pages in my domain with a number path. For example:

example.com/5
example.com/972
example.com/11
example.com/3451

Can I use:

example.com/\d+

Thanks

I am afraid page rules do not support that. You’d need to employ Workers for that.

What exactly do you want to achieve?

I want to cache all numeric pages under my domain.

example.com/1
example.com/2
example.com/3
example.com/4

example.com/124122

Can you move all your numeric pages under one common path?

@sandro sorry for the late reply.

No. I can’t. There are too many of the pages and all of them have been indexed. Is it possible to have this feature if I pay?

That would be aforementioned Worker. That would be custom JavaScript code where you can force the cache for such paths. Page rules do not support it.

Thanks for your fast reply. May I know more details about the way you mentioned?

Thanks,

https://developers.cloudflare.com/workers/ has all on that. You need to write your own JavaScript code which will handle all requests and forces caching for the desired paths.

Thanks!

Keep in mind, this will be a paid feature if you exceed the 100,000 free requests every day.

This topic was automatically closed after 14 days. New replies are no longer allowed.