Exclude pages from the cache and optimizations
Note that WP Rocket automatically excludes cart and checkout pages for certain ecommerce plugins. Read more about that here.
How to exclude individual pages
Directly in page settings
Heads up!
By excluding a page from cache, you are also excluding it from all other optimizations.
Using the Never Cache URL(s)s option
- 1
- Go to WP Rocket Advanced Rules tab.
- 2
- Locate the box Never cache URL(s).
- 3
-
Enter the URL of the page you wish to exclude. You can either enter the full URL e.g.
http://www.example.com/page/
or you can just enter the part after the domain name, e.g./page/
. Either way will work. - 4
- For multiple pages, enter each one on its own line:
How to exclude a group of pages at once
You can use simple Regex to exclude a specific set of pages.
For example, you have an events section on your site and you want to exclude all the event pages. Assuming they are set up as child pages, so that their URL structure is like this:
/events/your-event-here/ /events/another-event here/
You could use the following:
/events/(.*)
This won't exclude the parent page /events/
itself, but only all the child pages with /events/
in the URL, like for example /events/your-event-here/
, /events/your-other-event-here/
, etc...
So if you need to exclude the parent page /events/
and all its child pages, you'll need to use the following exclusions:
/events/ /events/(.*)
Heads up!
If you add /(.*)
in the Never cache (URLs) box, you are excluding every URL of your website from the cache and optimizations.
Should you use the trailing slash?
WP Rocket will automatically add or remove the trailing slash to your exclusions to match your site's configuration in Settings → Permalinks.
Hosting services where WP Rocket doesn't manage cache
If you are using one of the following hosting services, you will need to reach out to their support and ask them to exclude the above path patterns in order for the exclusions to work: DreamPress, Flywheel, Kinsta, Pressable, SpinupWP, WordPress.com, WP Engine