How to configure LiteSpeed cache to work with GeotargetingWP?

Litespeed generates page cache on your site, meaning that in order to use our plugin you should enable AJAX mode to avoid getting cached results in your browser.

If you are targeting just countries, there is an option to configure Litespeed and instruct it to create a different cached page based on countries. So for example for a page called /sample-page Litespeed will have multiple versions such as /sample-page.html-US and /sample-page.html-FR

Follow these steps to configure litespeed:

  1. Add the following rules to your .htacess file
                
                    GeoIPEnable On
                    RewriteEngine on
                    CacheLookup on
                    RewriteRule .* - [E=Cache-Vary:geot_rocket_country]
                
            
    This will instruct LiteSpeed to vary the cache files based on a cookie named geot_rocket_country
  2. Add the following code in your theme's functions.php file add_filter( 'geot/enable_rocket_cookies','__return_true');

    This code will make the plugin create the needed cookies in order to make litespeed created different cache versions. If you are using wprocket and wprocket mode, the code is not needed

Check out our WordPress geolocation solutions
to find out everything you can do!

Start your free trial