Page Rule Regex help

Hi all. Looking for some RegEx gurus to help me create a page rule.

I have a page rule https://example.com/* where I have Browser Cache TTL, Edge Cache TTL and Cache Level turned up to the max. I want to exclude a URL from it, but have child URLs maintain the ‘cache everything’ status.

So https://example.com/hello/ is excluded from the above cache settings, but https://example.com/hello/123456/ (as well as every other page URL sitting under /hello/) is cached by the page rule.

I tried using RegEx ‘negative look ahead’ and came up with:

https://example.com((?!/hello/$)*$

but that doesn’t seem to work. Any help greatly appreciated!

Page rules do not use regular expressions, but simply wildcards. In your case you might need to rules

  1. /hello -> dummy rule to skip the second one, just choose a random setting not interfering with others
  2. /* -> your actual rule to cache everything else

Wow, that was quick! Thanks for getting back to me so quickly.

So if I added a rule for /hello/ with whatever setting, /hello/there/ (for example) wouldn’t be affected?

As long as you do not put an asterisk at the end.

1 Like

Great! Thanks so much.

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