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]
-
This reply was modified 2 years, 10 months ago by
tripledm.
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]
@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]
Plugin Support
qtwrk
(@qtwrk)
maybe change [NC] [OR]
to [NC,OR]
?
I never seen a rule with two [XX]
though , not sure if is supported or not …
-
This reply was modified 2 years, 10 months ago by
qtwrk.
@qtwrk
Why shouldn’t it work? There is nothing wrong!
http://www.htaccesscheck.com/