Performance and monitoring

LiteSpeed Cache for PrestaShop: install and configure

Reviewed on 3 min read performance LiteSpeed Cache PrestaShop

Our servers use LiteSpeed, which has a built-in page cache. The LiteSpeed Cache for PrestaShop module, made by LiteSpeed itself, connects the shop to that cache: category and product pages are generated once and the server serves the following visits directly. The cart and customer data are loaded separately (with ESI), so the cache is also used for logged-in customers.

The current version (1.6) works with PrestaShop 1.7, 8 and 9. For PrestaShop 1.6 you will have to find an old version of the module in its repository; if that is your case, also plan to upgrade the shop, because 1.6 no longer receives security updates.

1. Prepare the shop

  • Disable any other page cache module (other kinds of cache, such as Redis, can stay enabled).
  • In Advanced Parameters > Performance, Debug mode section, check that Disable all overrides is set to No. The module needs overrides to load the cart and customer blocks separately.

2. Install the module

  1. Download the ZIP file of the latest version from the module's releases on GitHub.
  2. In the PrestaShop back office, go to Modules > Module Manager and click Upload a module. Select the ZIP.
  3. When it finishes, click Configure.

LiteSpeed Cache module installed in PrestaShop

3. Enable the cache

In LiteSpeed Cache > Settings, set Enable LiteSpeed Cache to Yes and save.

Enable LiteSpeed Cache option in the PrestaShop module

The rest of the options are well configured out of the box. When you enable it, the module adds this block to the beginning of the .htaccess file:

# LITESPEED_CACHE_START Do not remove this comment line, LiteSpeedCache plugin will automatically update this block
<IfModule LiteSpeed>
CacheLookup on
</IfModule>
# LITESPEED_CACHE_END

If the module shows an error when writing the .htaccess file, add the block yourself at the beginning of the file from cPanel's File Manager.

4. Check that it works

  1. Open a shop category in a private window.
  2. Press F12, go to the Network tab and reload.
  3. On the first request (the HTML document), the X-LiteSpeed-Cache header should show miss the first time and hit when you reload.

Then add a product to the cart, change language or currency if you use them, and check that everything responds properly. If a third-party module shows data that does not belong (for example, another visitor's cart), configure it in the module's Customization tab so it is loaded separately with ESI, or exclude that page from the cache.

Purge the cache

The module purges only what is needed when you change a product, a category or prices. If you change the theme or a module and do not see the change, go to LiteSpeed Cache > Manage, where you can purge selectively (by product, category or URL) or purge the whole cache:

Options for purging the LiteSpeed cache in PrestaShop

To stop using it, set Enable LiteSpeed Cache to No, purge everything and then uninstall the module.

You may also find useful

Something wrong or out of date? Tell us and we will review it.