Can I use regex in PageRules?

Hi,

first of all, I searched for this with “PageRule with regex” but only got 4 unrelated results.

I wonder if I can use regex in the PageRule.

I have a multilanguage website, if no locale is given in the URL, my application figures out the language from the browser and redirects.

Example:

German guy requesting example.net/some/article gets redirected to example.net/de/some/article
English guy requesting example.net/some/article gets redirected to example.net/en/some/article
and so on.

In short, I want to cache all pages that include a language in their URI.

I wonder if a pagerule like

cache example.net/(en|fr|de|es|pt|ru)/*

is possible. Or would I need to set 6 Page rules (one for each language) for this?

#Co

Test Before You Post
Unsure of the issue? Test before posting using the Cloudflare Diagnostic Center: Diagnostic Center | Check SSL and Test Website Security | Cloudflare

In short, you can’t - only wildcards allowed.

1 Like

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