Stuck with Vary Cache htaccess




Wordpress LScache Plugin: Stuck with Vary Cache htaccess


Hi There, Im struggling to implement vary cache on one of our sites based on the different variables of a cookie as below: RewriteCond % HTTP_COOKIE scwp_location=melbourne [NC] RewriteRule .? - [E=Cache-Vary:melbourne] RewriteCond % HTTP_COOKIE scwp_location=none [NC] RewriteRule .? - [E=Cache-Vary:melbourne] RewriteCond % HTTP_COOKIE scwp_location=darwin [NC] RewriteRule .? - [E=Cache-Vary:darwin] RewriteCond % HTTP_COOKIE scwp_location=sydney [NC] RewriteRule .? - [E=Cache-Vary:sydney] RewriteCond % HTTP_COOKIE scwp_location=perth [NC] RewriteRule .? - [E=Cache-Vary:perth] RewriteCond % HTTP_COOKIE !scwp_location [NC] RewriteRule .? - [E=Cache-Vary:null]Expand Any indication as to what were doing wrong? Is it possible weve inserted it into ht access in the wrong place or are our declarations wrong? The page I need help with: https://summercampfestival.com.au/ Hi, if you want to vary on cookie , you should use E=Cache-Vary:my_cookie] where m_cookie is the cookie name , it will automatically differentiate based on cookie value on , from your code , you need to use [E=Cache-Control:scwp_location=% ENV:LSCACHE_VARY_VALUE +melbourne] [E=Cache-Control:scwp_location=% ENV:LSCACHE_VARY_VALUE +darwin] [E=Cache-Control:scwp_location=% ENV:LSCACHE_VARY_VALUE +sydney] you will need % ENV:LSCACHE_VARY_VALUE to carry over the current/previous vary into next rule as well Best regards, Right thanks @CacheCrawler So the full code to vary based on the cookie is the following? RewriteRule .? - [E=Cache-Vary:scwp_location] Or do I need the extra cache control declarations for each individual cookie value? Also where is the best place to insert this into the .htaccess file, above or below the automatic LScache section? As a follow up, I tried using the following, it varied the cache only on the homepage but no where else: RewriteEngine on CacheLookup on RewriteRule .? - [E=Cache-Vary:scwp_location] Hi, no , you dont need extra control for each cookie value enable cache plugin , then add this line at top of your .htaccess, dont add it inside of LSCWP block Best regards, Perfect, thats what I tried and what worked for me! Thanks for your help.