Exclude Pages from the Cache
It is very simple to exclude a page or pages from the cache. 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
In WP Rocket settings
- Go to WP Rocket Advanced Rules tab.
- Locate the box Never cache (URLs).
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.
- For multiple pages, enter each one on its own line:
Should you use the trailing slash?
Whether or not you include a trailing slash at the end of the URL depends on how your site is set up. You can go to Settings → Permalinks and look at the structure you are using. If it ends with a slash (
/), such as
/%postname%/ (which is the most typical), you must include it when adding URLs to this box.
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:
This would exclude the page
/events/ itself, and all the pages with
events/ in the URL, like for example
If you add
/(.*) in the Never cache (URLs) box, you are excluding every URL of your website from the cache and optimizations.