Exclude JUST the Wordpress homepage from varnish


#1

Does anyone know how to exclude just the homepage form the varnish cache. The docs seem to suggest all the paths below the exclusion rule will be excluded so if just / is used then I believe all pages will be excluded. Any help much appreciated


#2

The Varnish URL exclusion rules allow for the use of Regex. So you would enter /$ to exclude only the home page.

The $ symbol says “don’t match if the target string has any characters beyond where I have placed the dollar sign”.

Test to confirm, of course.

Paul


#3

Thank you so much Paul


#4

Sorry - should have mentioned - that rule is very specific for URLs with nothing after the root domain name. So it will not kick in if the URL includes things like variables such as UTM tracking codes or other variables introduced by a "?"
e.g. example.com?utm_source=google&utm_medium=email

If your home page occasionally has those kinds of variables added, you’ll need a more specific regex rule to capture those use cases.

Paul