How to Exclude Pages from the LiteSpeed Cache

Most WordPress pages should be cached, but a few need to be built fresh for every visitor: a page that shows live stock or prices, a members-only area, a booking calendar, or a form from a plugin that doesn't play well with caching. This guide shows how to exclude a page from the LiteSpeed Cache on your Instant Access Internet Services site, either one page at a time or by URL pattern, cookie or user role.

Do you really need to exclude it?

LiteSpeed Cache already handles the pages that must never be shared between visitors, so you don't need to add these yourself:

  • Pages viewed by logged-in users. These are never served from the shared cache; with the default Cache Logged-in Users setting they're kept in a private cache for that one user only.
  • The WordPress admin area and the login page.
  • WooCommerce Cart, Checkout and My Account pages.

If a page only looks out of date after you edit it, you probably need to purge it rather than exclude it. Excluding a page makes it slower for every visitor, so only exclude what really must stay dynamic.

Option 1: Exclude a single page from the editor

This is the easiest way to exclude one post, page or product.

  1. In WordPress, open the page for editing (Pages > All Pages, then click the page title).
  2. Find the LiteSpeed Options box. In the block editor it's usually below the content; in the Classic Editor it's in the sidebar or under the content.
  3. Turn on the Disable Cache switch (it turns blue).
  4. Click Update (or Save).

If you don't see the box, in the block editor open the three-dot menu > Preferences > Panels and enable LiteSpeed Options. In the Classic Editor, open Screen Options at the top and tick LiteSpeed Options.

Option 2: Exclude pages by URL with Do Not Cache URIs

Use this for a group of pages, such as everything under /members/, or when a page isn't a normal WordPress post.

  1. Go to LiteSpeed Cache > Cache and click the Excludes tab.
  2. In Do Not Cache URIs, enter one path per line. Leave out the domain name.
  3. Click Save Changes, then purge the cache (LiteSpeed admin bar icon > Purge All).

How the matching works:

You enterWhat it excludes
/members/Any URL that contains /members/ anywhere (partial match)
^/members/Only URLs that start with /members/, such as /members/profile/
/booking/$Only URLs that end in exactly /booking/
^/contact/$Exactly the /contact/ page and nothing else

Be careful with short partial matches. An entry like /shop also matches /shopping-tips/ and /workshop/.

Other ways to exclude content

The same Excludes tab has more options. Enter one item per line.

  • Do Not Cache Query Strings - skip caching when a URL has a certain query string, for example currency for ?currency=EUR.
  • Do Not Cache Categories and Do Not Cache Tags - skip posts in a particular category or with a particular tag.
  • Do Not Cache Cookies - skip caching for visitors who have a certain cookie. Useful for plugins that personalize pages with a cookie (a wishlist or a currency switcher, for example). The plugin's own documentation usually names the cookie.
  • Do Not Cache User Agents - skip caching for particular browsers or apps. Rarely needed.
  • Do Not Cache Roles - tick roles (for example Shop Manager or Editor) whose visits should never be cached, not even in the private cache. Handy if you're an administrator testing changes and always want to see fresh pages.

Exclude a page from optimization but keep it cached

Sometimes the page cache is fine and it's the CSS/JS optimization that breaks a page. In that case, keep the page cached and exclude it from optimization instead: go to LiteSpeed Cache > Page Optimization > Tuning and add its path to URI Excludes. The page stays fast, but its CSS and JS are left alone.

How to check the exclusion worked

Open the page in a private browser window, press F12, go to the Network tab, reload and click the first request. An excluded page no longer shows x-litespeed-cache: hit. Instead you'll usually see an x-litespeed-cache-control: no-cache header. If it still says hit, purge all and check again.

Common questions

My contact form says "nonce" or "expired" errors

Some form plugins put a security token in the page that expires. Try excluding the form page with the Disable Cache switch first. If the form is on every page (in a footer, for example), open a ticket and we can help you find a better fix.

Can I exclude a whole post type?

Not directly from the Excludes tab. If all posts of that type share a URL prefix, such as /events/, exclude that prefix with ^/events/ in Do Not Cache URIs.

Related guides

Still stuck? Open a support ticket and the Instant Access Internet Services team will help.

Ultrafast LiteSpeed hosting from InstantAccess.net: free SSL, free backups, cPanel included, no contracts. Check out our $10/month hosting.
  • exclude page from litespeed cache, litespeed cache do not cache uris, litespeed cache exclude url, disable cache for one page wordpress, litespeed cache excludes, wordpress page not updating
  • 0 کاربر این را مفید یافتند
آیا این پاسخ به شما کمک کرد؟

مقالات مربوطه

How to Speed Up WordPress with LiteSpeed Cache

Instant Access Internet Services servers run the LiteSpeed web server, so the fastest way to...

What Is LiteSpeed? How Our Web Server Makes Your Website Faster

Every website we host runs on the LiteSpeed web server, a faster drop-in replacement for Apache....

How to Turn On LiteSpeed Cache with the Web Cache Manager in cPanel

You can turn on LiteSpeed Cache for WordPress without logging in to WordPress at all. The...

Best LiteSpeed Cache Settings for WordPress (Using Presets)

The easiest way to get the best LiteSpeed Cache settings for WordPress is to use the plugin's...

How to Clear (Purge) the LiteSpeed Cache in WordPress

If you've updated your WordPress site but visitors still see the old version, you need to clear...