Disclosure: When you purchase a service or a product through our links, we may earn a commission. Read more...

Last updated:

QUICK GUIDE TO SETUP LITESPEED CACHE PLUGIN

Litespeed Hands On Visual

TipsMany of the optimization features can be used when using any of the following web servers: LiteSpeed, Apache, NGiNX, etc. The caching features, however, require either free OpenLiteSpeed, commercial LiteSpeed Enterprise Edition, LiteSpeed-powered hosting providers like A2 Hosting, or the new QUIC.cloud CDN.

General

Enable LiteSpeed Cache

You can enable LiteSpeed cache only when pre-requisites have fulfilled (read above). Otherwise, you should see the corresponding error message. You can peek here to get some overview of how to test the cache. NB! When disabling the cache, all cached entries for your website will be purged.

LiteSpeed Setting Enabled

Automatically Upgrade

Turn this option ON to have LiteSpeed Cache updated automatically, whenever a new version is released. However, it is strongly recommended to turn this OFF and apply updates manually.

LiteSpeed Setting Off

TipsFor all the Time-To-Live (TTL) settings you can easily use the default values that are already present. Probably you never need to change those values, because they work already the best optimum way for you. Do not forget to click on “Save Changes” afterward. Please note that the value fields expecting some number value in seconds.

Cache

Cache Mobile

Turn this option OFF when your website doesn’t have either AMP or mobile-specific design/content. For responsive websites turning this option ON is not necessary.

NB! This setting will edit the .htaccess file.

LiteSpeed Setting Off

TipsFor all other settings, you can easily use the default values. Probably you never need to change those values, because they work already the best optimum way for you. Do not forget to click on “Save Changes” when you have changed any of the toggles.

Purge

Purge All On Upgrade

Turn this option ON to have LiteSpeed Cache updated automatically, whenever a new version is released. However, it is strongly recommended to turn this OFF and apply updates manually.

LiteSpeed Setting On

Auto Purge Rules for Publish/Update

I strongly do recommend to tick “All pages” option to make sure that nothing isn’t cached when content has updated. Usually, it’s a good practice to purge only pages where the content has changed. On the other hand, people tend to forget such a rule like “Auto Purge“. That’s why the safest bet is to choose purge all option. Make sure you know what are you doing when choosing another way.

LiteSpeed Purge All

Scheduled Purge URLs

If you have content that is generated by an outside source at a certain time every day, then you might want to purge the page to be sure the outside content is correctly displayed. You can specify a list of URLs (one per line) that will be purged automatically at a certain time of day.

NB! Specifying those URLs is not necessary under normal circumstances.

1. line: https://yourdomain/events/list.php
2. line: /events/list.php

TipsNote that the second URL points to the same URL as the first one.

Scheduled Purge Time

Excludes

Here you can specify the purge time when you have fulfilled “Scheduled Purge URLs” field.

10:00 PM

Force Cache URIs

You can specify special URIs to force caching regardless of any “non-cacheable” settings that may appear elsewhere. Also, you can overwrite default TTL value when the current value doesn’t satisfy your needs.

NB! You can use special characters “^” and “$“, to indicate the beginning of a string and/or the end of a string e.g. ^/events/list/$.

1. line: /events/list/?category=online 300
2. line: /events/list/?category=classes 600
3. line: /events/list/$

TipsNote that by default events page will use default TTL caching period. Although, online and classes category will use accordingly 300 and 600 seconds of caching period.

Do Not Cache URIs

You can specify your own URIs to skip caching regardless of any “cacheable” settings that may appear elsewhere.

NB! You can’t use TTL values at the end of URI strings here because this is for caching only.

1. line: /events/list/
2. line: /events/list/$
3. line: ^/events/list

TipsYou can also use special characters “^” and “$” here. This setting is very useful when some REST API calls need to be excluded from the cache mechanism.

Do Not Cache Query Strings

The query string is the part of URI what stays on the right side from “?” symbol e.g. https://www.yourdomain.com/events/list/?category=online where the query string is category=online.

1. line: category

TipsYou don’t want to cache any pages where categories are used.

Do Not Cache Categories

To prevent categories from being cached you can exclude any by entering particular category slug value for this setting. Example https://www.yourdomain.com/category/{category-slug}/ e.g. review.

1. line: category-slug
2. line: category-slug-2

TipsYou can insert multiple category slugs, one per line.

Do Not Cache Tags

To prevent tags from being cached you can exclude any by entering particular tag slug value for this setting. Example https://www.yourdomain.com/tag/{tag-slug}/ e.g. wordpress.

1. line: tag-slug
2. line: tag-slug-2

TipsYou can insert multiple tag slugs, one per line.

Do Not Cache Cookies

This is a list of cookies telling that, do not cache any page where a cookie in this list appears in the request headers. In normal circumstances, you don’t need to use that option.

NB! This setting will edit the .htaccess file.

1. line: yummy_cookie

TipsYou can insert multiple cookies, one per line. Spaces should have a backslash in front of them,\

Do Not Cache User Agents

When a visitor requests a page from your site via one of the listed user agents, they will not be served from the cache. In normal circumstances, you don’t need to use that option.

NB! This setting will edit the .htaccess file.

1. line: Mozilla/5.0

TipsYou can insert multiple user agents, one per line. Spaces should have a backslash in front of them,\

Do Not Cache Roles

When you are an administrator, testing new functionality, you may want to exclude yourself from being served from cache until your testing is done.

LiteSpeed Administrator Role

 

A2 Hosting Speed Banner

 

 

A2 Hosting servers are located around the globe in the US, UK, Canada, Brazil, France, Germany, Australia, India, etc.

* Technologies used by BestCloudTools website

Optimize (Advanced)

Optimize and Tuning are two closely related tabs. Generally speaking, you will find the ON/OFF switches in Optimize, and the customizations that go along with these switches in Tuning.

CSS Minify

Turn this option ON to remove unnecessary or redundant data without affecting how the resource is processed by the browser – e.g. code comments and formatting, removing unused code, using shorter variable and function names, and so on.

LiteSpeed Setting On

CSS Combine

Each CSS file you are using for your website adds time to your page load speed. Sometimes this is unavoidable, however, when turning this option ON you can combine all CSS files together. Use Tuning -> CSS Excludes option when any CSS file needs to be excluded from the combined file.

LiteSpeed Setting On

CSS HTTP/2 Push

Turn this option ON to pre-send internal CSS files to the browser before they are requested.

NB! Connections must use SSL.

LiteSpeed Setting On

JS Minify

Turn this option ON to remove all unnecessary characters from the JavaScript source codes without changing functionality.

LiteSpeed Setting On

JS Combine

Each JS file you are using for your website adds time to your page load speed. Sometimes this is unavoidable, however, when turning this option ON you can combine all JS files together. Use Tuning -> JS Excludes option when any JS file needs to be excluded from the combined file.

LiteSpeed Setting On

JS HTTP/2 Push

Turn this option ON to pre-send internal JS files to the browser before they are requested.

NB! Connections must use SSL.

LiteSpeed Setting On

HTML Minify

HTML minification removes all unnecessary characters from the source code without changing functionality. I do recommend to turn this option ON.

LiteSpeed Setting On

Inline CSS Minify

Minify inline CSS code. I do recommend to turn this option ON.

NB! HTML Minify must be enabled.

LiteSpeed Setting On

Inline JS Minify

Minify inline JS code. I do recommend to turn this option ON.

NB! HTML Minify must be enabled.

LiteSpeed Setting On

Load CSS Asynchronously

Keep this option OFF, otherwise please extract Critical CSS from the rest of the CSS code or leave this job for LiteSpeed CCSS server. Please be noted that this is an advanced technique and can be quite tricky. When you are responsible to maintain or build a rather complex website, this feature is not worth the hassle.

LiteSpeed Setting Off

Load JS Deferred

JavaScript is considered a “parser blocking resource” and hence plays a crucial part in Critical Rendering Path. I do recommend to use deferred loading for Javascript files whenever possible.

LiteSpeed Setting On

Exclude JQuery

This option improves compatibility with inline JavaScript. When you use JS Combine feature, it is recommended that this setting remains ON.

LiteSpeed Setting On

DNS Prefetch

Prefetching DNS can reduce latency significantly for your visitors when they click to external links, particularly on mobile networks. Domains should be entered one per line.

1. line: //www.litespeedtech.com
2. line: //www.a2hosting.com

Remove Comments

When JS and CSS files have minified, comments can take up valuable space. I do recommend to turn ON this option to strip comments from minified files and make them more efficient to transmit.

LiteSpeed Setting On

Tuning (Advanced)

Combined CSS Priority

Normally, combined CSS is loaded after external CSS files. Leave this option disabled, because combined local CSS is more likely to have customizations that need to be loaded after the base CSS. Enable this option if you have reason to load combined CSS before other CSS files.

LiteSpeed Setting Off

CSS Excludes

Here you can list down all the CSS files what should not be minified/combined. Both full URLs and partial strings can be used, one per line. Filter with the name litespeed_cache_optimize_css_excludes is also supported. All the elements with an attribute data-no-optimize="1" in HTML code will be excluded.

1. line: https://www.yourdomain.com/wp-content/plugins/cookie-pot/css/cookies.css
2. line: cookie-pot/css/cookies.css

TipsNote that the second file location points to the same resource as the first one.

Combined JS Priority

Normally, combined JavaScript is loaded after external JavaScript files. Leave this option disabled and enable if you have reason to load combined JavaScript before other JavaScript files.

LiteSpeed Setting Off

JS Excludes

Here you can list down all the JS files what should not be minified/combined. Both full URLs and partial strings can be used, one per line. Filter with the name litespeed_cache_optimize_js_excludes is also supported. All the elements with attribute data-no-optimize="1" in HTML code will be excluded.

1. line: https://www.yourdomain.com/wp-content/plugins/cookie-pot/js/cookies.js
2. line: cookie-pot/js/cookies.js

TipsNote that the second file location points to the same resource as the first one.

Remove Query Strings

Removes query strings from static resources. There are rumors that some servers and proxy servers are unable to cache properly when query strings are used. Although this can improve your speed score in services like Pingdom, GTmetrix, and PageSpeed, it can cause a bad user experience for your visitors when you update a particular plugin or theme. Only use this option when you do not update your WordPress often.

NB! Please remember that query strings are usually there for a reason, especially in the WordPress world.

LiteSpeed Setting On

Remove WordPress Emoji

Browser default emoji will be displayed instead of wordpress.org emoji. I do recommend to turn this option ON when you do not need to use emojis.

LiteSpeed Setting On