Wordpress LScache Plugin: Do Not Cache Cookies from cache
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hello, we have a weird installation with some custom login parts and Learndash. The problem is when a user is logging in then another users details is showing so a cache issue. Do Not Cache Cookies, as the user session cookies are unique is it possible to only enter part of the cookie as it might be session_cookie_11122 as example where the number is dynamic so just need to know if start or partial is good enough for it to pick it up and exclude that cookie from being cached. Thank you. Cache plugin function to do not cache cookies expects the cookie name and not its value. You want a cookie not to be cached if he has a value like xyz . This cannot be done with plugin functions, so you must it do hardcore with .htaccess rewrite rules. If the cookie prefix value is session_cookie_ you can define a wildcard suffix like: RewriteCond % HTTP_COOKIE session_cookie_=[0-9]+ [NC] RewriteRule . - [E=Cache-Control:no-cache] I hope that is what you asked for? that helps a lot thank you I am going to give that a try Sorry just to ask, if I have multiples ok to do with one rewrite rule eg. RewriteCond % HTTP_COOKIE session_cookie_=[0-9]+ [NC] RewriteCond % HTTP_COOKIE session_cookie2_=[0-9]+ [NC] RewriteCond % HTTP_COOKIE session_cookie3_=[0-9]+ [NC] RewriteRule . - [E=Cache-Control:no-cache] Change it to: RewriteCond % HTTP_COOKIE session_cookie_=[0-9]+ [NC] [OR] RewriteCond % HTTP_COOKIE session_cookie2_=[0-9]+ [NC] [OR] RewriteCond % HTTP_COOKIE session_cookie3_=[0-9]+ [NC] RewriteRule . ? [E=Cache-Control:no-cache] thank you! @tripledm There was a typo in my code, so you have to correct it, sorry. RewriteCond % HTTP_COOKIE session_cookie_[0-9]+ [NC] [OR] RewriteCond % HTTP_COOKIE session_cookie2_[0-9]+ [NC] [OR] RewriteCond % HTTP_COOKIE session_cookie3_[0-9]+ [NC] RewriteRule . ? [E=Cache-Control:no-cache] maybe change [NC] [OR] to [NC,OR] ? I never seen a rule with two [XX] though , not sure if is supported or not ? @CacheCrawler Why shouldnt it work? There is nothing wrong! http://www.htaccesscheck.com/
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference