Page Rule for any 4 digit number after URL

Hi :slight_smile:

I need a page rule that will apply to any URL containing 4 digits and a β€˜-’

so like this for example www.mydomain.com.au/1234-some-variable-text

I tried:

www.mydomain.com.au/****-*
www.mydomain.com./$1$2$3$4-*
www.mydomain.com/^\d{4}*
www.mydomain.com/[0-9][0-9][0-9][0-9]*

ha ha no luck :(. can it be done?

thanks

I also tried this, no good

www.mydomain.com/*-

I don’t believe Page Rules accept a regular expression, only wildcard *.

Transform Rules on the other hand do accept regular expressions.

2 Likes

Thanks

The rule I want to create is Cache Everything, so I guess it’s impossible.

Not really. Cache Rules (beta) can also use regex match (but only for Business or Enterprise Plan).

URI Path matches regex "^/[0-9]{4}-"

If you are on a Pro or Free Plan, and assuming all URLs on your site that begin with a number are those with a 4-digit number, you can try using instead a long list of combinations:

URI Path starts with "/0"
OR
URI Path starts with "/1"
...
URI Path starts with "/9"

Then
Eligible for Cache…

2 Likes

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