How to Install and Configure LiteSpeed Cache for CS-Cart Print

  • 0

Overview

LiteSpeed Cache for CS-Cart provides full-page caching at the web-server level for faster storefront loading times, improved SEO, and reduced server load. It integrates directly with LiteSpeed Web Server Enterprise and works with both CS-Cart and CS-Cart Multi-Vendor editions.

Note: LiteSpeed Cache requires LiteSpeed Web Server Enterprise (or LiteSpeed Web ADC) with the LSCache module enabled. It will not work fully on OpenLiteSpeed because ESI (Edge Side Includes) is not supported there.

1. Requirements

  • LiteSpeed Web Server Enterprise 5.4 or later with lscache module enabled
  • CS-Cart 4.11 or later (Multi-Vendor supported)
  • PHP 7.2 or newer (PHP Redis and LSAPI recommended)
  • Access to the CS-Cart admin panel and file manager (or SSH/SFTP)

2. Download the Add-On

Download the latest LiteSpeed Cache add-on package for CS-Cart from the official sources:


3. Upload the Add-On

  1. Extract the downloaded archive on your local machine.
  2. Upload the extracted folder to your CS-Cart installation under:
    /app/addons/
  3. Ensure file permissions and ownership match your CS-Cart installation.

4. Activate the Add-On in CS-Cart

  1. Log in to your CS-Cart Admin Panel.
  2. Go to Add-ons → Manage Add-ons.
  3. Click Upload & Install Add-on.
  4. Select the LiteSpeed Cache add-on and install it.
  5. Once installed, ensure its status is set to Active.

5. Update the .htaccess or Rewrite Rules

The add-on package includes a sample configuration file named htaccess_lscache.

Merge its contents into your existing CS-Cart .htaccess file in the site root, keeping the following rewrite section:

# LiteSpeed Cache Start
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{HTTP_HOST} (.+)
RewriteCond %{REQUEST_URI} !^/admin.php
RewriteCond %{REQUEST_URI} !^/api/
RewriteCond %{QUERY_STRING} !nocache
RewriteCond %{REQUEST_URI} !/checkout/
RewriteCond %{REQUEST_URI} !/profile/
RewriteRule .* - [E=Cache-Control:max-age=3600]
# LiteSpeed Cache End

Save the file and clear existing caches using your hosting control panel or CS-Cart’s admin tools.


6. Verify Cache Operation

  1. Open your store in a browser and refresh a few times.
  2. In Developer Tools → Network tab, look for the response header:
    X-LiteSpeed-Cache: hit or miss.
  3. If you see those headers, LiteSpeed Cache is active.

7. Common Configuration Tips

  • Dynamic Blocks: The add-on uses ESI to cache public content while keeping dynamic cart and user data fresh.
  • Purge Cache: Use Administration → Storage → Clear Cache in CS-Cart, or run:
    touch var/cache/clear_cache
  • Exclude Sensitive URLs: Add checkout, cart, and admin paths to the exclusion list in the add-on settings.

8. Troubleshooting

  • Ensure your domain resolves to the same server running LiteSpeed Web Server.
  • Confirm the LSCache module is enabled:
    grep LSCACHE /usr/local/lsws/conf/httpd_config.conf
  • Check permissions on var/cache/ directory.
  • Review server logs in /usr/local/lsws/logs/ for LSCache-related messages.

More Information


Was this answer helpful?

« Back