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.
In WP Rocket settings
- 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:
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
Should you use the trailing slash?
WP Rocket 3.12.3.2 and later
WP Rocket will automatically add or remove the trailing slash to your exclusions to match your site's configuration in Settings → Permalinks.
WP Rocket 3.12.3.1 and older
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:
/events/(.*)
This would exclude the page /events/
itself, and all the pages with events/
in the URL, like for example /events/your-event-here/
.
Heads up!
If you add /(.*)
in the Never cache (URLs) box, you are excluding every URL of your website from the cache and optimizations.