I've successfully not cached pages when a user has an item in cart/is logged in/etc by setting a cookie such as page_contain_cache_token. I'd like to not SERVE those cached pages to other users. How do I prevent a user from being served cached pages while they're logged in or have an item in cart?
Current rules:
Current rules:
Code:
<IfModule LiteSpeed>
RewriteEngine On
# cache should be available for HEAD or GET requests
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
# select which pages to cache
RewriteCond %{HTTP_COOKIE} page_contain_cache_token=yes
# excluding certain URLs
RewriteCond %{REQUEST_URI} !/(login|checkout|cart|private|profile|cron|image)$
# cache for 5 mins
RewriteRule .* - [E=Cache-Control:max-age=300]
</IfModule>
Last edited by a moderator: