> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Enabling caching for PrestaShop on Turbo servers

> Enable caching for PrestaShop on Turbo servers using the LiteSpeed plugin or .htaccess rules to boost performance and page load speed.

This article describes how to enable caching for PrestaShop on a Turbo server.

<Note>
  The information in this article is specific to PrestaShop. For general information about caching on Turbo accounts, please see [this article](/docs/enabling-caching-on-turbo-web-hosting).
</Note>

## Enabling caching for PrestaShop version 1.7 or newer

To enable caching for PrestaShop version 1.7 (or a newer version), use the [LSCache Module for PrestaShop](https://www.litespeedtech.com/products/cache-plugins/prestashop-acceleration). To do this, follow these steps:

1. Go to [https://www.litespeedtech.com/products/cache-plugins/prestashop-acceleration/download](https://www.litespeedtech.com/products/cache-plugins/prestashop-acceleration/download).

2. Download **LSCache Module 1.4.1** .

3. Log in to PrestaShop as the administrator.

4. In the left sidebar, under **IMPROVE**, click **Modules**, and then click **Module Manager**.

5. Click **Upload a module**.

6. Click **Browse**, and then select the *.zip* file you downloaded in step 2. PrestaShop installs the module.

7. Click **Configure**.

8. In the **General v1.4.1** section, click **Enable LiteSpeed Cache**.

9. Click **Save**. Caching is now enabled for PrestaShop.
   > 👍 Tip
   >
   > To verify that caching is working correctly on your account, you can examine the raw HTTP headers sent between the browser and web server. (To do this, use a browser plugin that displays the raw headers such as Live HTTP headers for Mozilla Firefox, or the Developer Tools feature in Google Chrome.) When content is served from the cache, the server adds the following line to the HTTP response header:
   >
   > ```
   > X-LiteSpeed-Cache: hit
   > ```
   >
   > If you do not see this line in the HTTP response header from the server, then the content was not served from the cache.

## Enabling caching for PrestaShop version 1.6 or older

To enable caching for PrestaShop version 1.6 (or an older version), follow these steps:

1. Log in to PrestaShop as the administrator.

2. On the left-side pane, click **Modules and Services**.

3. Under **MODULES LIST**, in the search text box, type `a2`.

4. The **A2 Hosting with TurboCache** module appears. If the module is **not** installed:

* Click **Install**.

  > 📘 Note
  >
  > If you receive a message about module verification, click **Proceed with the installation** .

  > 👍 Tip
  >
  > * If you install PrestaShop using Softaculous, the A2 Hosting with TurboCache module is automatically installed and enabled.
  >
  > * After the TurboCache module is installed and enabled, you do not need to do any additional module configuration.

5. In the directory where you installed PrestaShop, open the *.htaccess* file in a text editor. You can use one of the [text editors in cPanel](/docs/cpanel-file-manager-editors), or you can log in to your account [using SSH](/docs/using-ssh-secure-shell) and use a command-line editor.

<Note>
  If the *.htaccess* file does not exist, create it.
</Note>

6. Copy the following text and paste it at the top of the *.htaccess* file:

```
<IfModule LiteSpeed>
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} ^GET|HEAD|PURGE$
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteCond %{REQUEST_URI} !admin123|404|address|authentication|best-sales|cart|contact|discount|guest-tracking|history|identity|order|password|products-comparison|search|account|friend|login|logout|addresses|contact-us|order-history|my-account|order-confirmation|order-follow|quick-order|credit-slip|password-recovery [NC]
    RewriteCond %{HTTP_COOKIE} !logged|cart [NC]
    RewriteCond %{QUERY_STRING} !nocache [NC]
    RewriteRule .* - [E=Cache-Control:max-age=900]
</IfModule>
```

<Warning>
  **Important**

  * These caching configuration directives must be at the **top** of the *.htaccess* file.

  * You only need to include the **HTTP\_HOST** configuration line if you host more than one domain in the *public\_html* directory (such as your primary domain and a subdomain). Replace ***example.com*** with the domain name for which you want to enable caching.

  * In the **REQUEST\_URI** configuration line, replace ***admin123*** with the PrestaShop administration folder name that you specified during the installation process.

  * For any friendly URLs you include in the **REQUEST\_URI** configuration line, make sure you also include any corresponding translated (rewritten) URLs. (To view friendly URLs in the PrestaShop administration interface, click **Preferences** and then click **SEO & URLs**.)

  * The **QUERY\_STRING** configuration line enables you to see the non-cached version of any page by adding **nocache** to a [query string](https://en.wikipedia.org/wiki/Query_string)in the URL. For example, to view the non-cached version of *[http://example.com/mypage](http://example.com/mypage)*, you could add *?any\_field=any\_value\&nocache* to the end of the URL.
</Warning>

7. Save your changes to the *.htaccess* file. Caching is now enabled for PrestaShop.

<Tip>
  To verify that caching is working correctly on your account, you can examine the raw HTTP headers sent between the browser and web server. (To do this, use a browser plugin that displays the raw headers such as Live HTTP headers for Mozilla Firefox, or the Developer Tools feature in Google Chrome.) When content is served from the cache, the server adds the following line to the HTTP response header:

  ```
  X-LiteSpeed-Cache: hit
  ```

  If you do not see this line in the HTTP response header from the server, then the content was not served from the cache.
</Tip>

### Caching and static content

Turbo accounts do not cache static content, such as audio and image files, on the web server. This type of content is cached by client web browsers instead. However, you can specify how long web browsers should cache your static content by using the **ExpiresByType** directive in the *.htaccess* file. For example, the following lines instruct web browsers to cache MP3 files for one year (31557600 seconds) and GIF files for 30 days (2592000 seconds):

```
ExpiresByType audio/mp3 A31557600
ExpiresByType image/gif A2592000
```

For more information about the **ExpiresByType** directive, please visit [https://httpd.apache.org/docs/2.4/mod/mod\_expires.html#ExpiresByType](http://httpd.apache.org/docs/2.4/mod/mod_expires.html#ExpiresByType).

## More information

For detailed information about LiteSpeed caching, please visit [https://docs.litespeedtech.com/lscache](https://docs.litespeedtech.com/lscache).

## Related articles

* [Enabling caching on Turbo servers](/docs/enabling-caching-on-turbo-web-hosting)
