• Resolved cyrix2000

    (@cyrix2000)


    Hi,

    I’d like to use cache vary by country but want to generate a separate cache for every EU country, UK and Norway and another combined cache for the rest of the world.

    At the moment I’m using

    <IfModule LiteSpeed>
      RewriteEngine on
      RewriteRule .* - [E=Cache-Control:vary=%{ENV:GEOIP_COUNTRY_CODE}]
    </IfModule>
    

    which builds up a separate cache for every country.

    What would be the code for the scenario described above?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support qtwrk

    (@qtwrk)

    you can try something like this

    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} (ES|DE|IT|BE)
    RewriteRule .* - [E=Cache-Control:vary=EU_COUNTRY]
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} UK
    RewriteRule .* - [E=Cache-Control:vary=UK_COUNTRY]
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} NO
    RewriteRule .* - [E=Cache-Control:vary=NO_COUNTRY]
    

    add more EU country 2-letter code into first condition

    Thread Starter cyrix2000

    (@cyrix2000)

    Thanks, and every country not explicitly listed in a vary statement will automatically end up in in a common cache?

    Plugin Support qtwrk

    (@qtwrk)

    yes, it will be like you end up in 4 varies , vary1 for EU , vary2 for UK , vary3 for NO , and vary4 for rest of not-meet-condition countries

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cache Vary in two country groups’ is closed to new replies.