Excluding Pages from the LiteSpeed Cache
Learn how to leave pages out of the LiteSpeed cache. Some pages must be built fresh for every visitor, such as an account area, a booking form or a page showing live figures. The steps below are for WordPress, with other types of website covered afterwards.
Steps
- Log in to your WordPress admin dashboard. See Logging in to WordPress from the Zeniar Portal
- Select LiteSpeed Cache from the left-hand menu, then click Cache
- Click the Excludes tab
- In Do Not Cache URIs, enter the path of each page to leave out, one per line, for example /my-bookings
- Click Save Changes
- Purge the cache so that any copy already saved is removed. See Purging the LiteSpeed Cache in WordPress
- Check the page in a private or incognito window. See Checking Whether LiteSpeed Cache Is Working
Please note: The same tab has Do Not Cache Cookies and Do Not Cache Roles, which leave out visitors who carry a certain cookie or have a certain user role.
Note: WooCommerce cart, checkout and account pages are left out for you. See Using LiteSpeed Cache with WooCommerce
The pages you listed are now built fresh for every visitor.
Custom Websites Using .htaccess Rules
Add the start of each address to the list in brackets on this line of your cache rules, separated by upright bars. See Caching a Custom or AI-Built Website with LiteSpeed
RewriteCond %{REQUEST_URI} !^/(admin|login|account|cart|checkout|my-bookings)
Laravel Projects
Give the route the no-cache setting, or simply leave the lscache setting off it. See Installing LiteSpeed Cache for Laravel
Route::get('/my-bookings', [BookingController::class, 'index'])->middleware('lscache:no-cache');