Optimize WordPress with LiteSpeed Cache plugin
Written by: Simon A. Skaar

LiteSpeed webserver (LSWS) is a webserver with extremely good performance compared to other webservers. LiteSpeed can replace Apache without one having to do any changes to the configuration file for the installation.

LiteSpeed cache plugin

If your installation is located on a server that is running LiteSpeed, you can use powerful plugins from LiteSpeed that will ensure full optimization and caching of your website. There are modules created for WordPress, Joomla, OpenCart, Drupal 8 and several of the popular CMS systems. At PRO ISP LiteSpeed is free to use if you have Pro Medium, Pro Premium or Enterprise web hosting.

LiteSpeed cache for WordPress is one of those powerful plugins available when on LiteSpeed server. The plugin offers optimization of your website, with cache, optimization of scripts and pictures. One of the best benefits of using LiteSpeed Cache plugin is that you can optimize your website with just a few clicks.

To install the plugin, select it from the plugin library accessible from your admin panel, or see our guide “How to install LiteSpeed cache plugin for WordPress“.

How to optimize web shop

When you have installed and activated the plugin, standard configuration will be active, and you will be able to see the four first options under “Settings”. Normally you will not need to change any of these.

Tab #5 – WooCommerce will only be visible if you already have WooCommerce active.

As soon as you active the plugin, the optimization will begin, and standard cache will be activated. To see other settings, select “Show advanced options”. A selection of 12 tabs will appear (thirteen if you have WooCommerce installed).

Optimize (tab #5)

Optimize contains Minify, combining and HTTP/2-push of scripts and is important when optimizing a website. In short terms it removes any unnecessary code, comments and combine CSS and JS files, resulting in fewer request for your visitors.

With the changes mentioned under this section, we had good results from GTMetrix.

This is the results before the Optimize function was activated (cache was already activated).

Before enabling recommende Optimize - Litespeed for WordPress

This is the results after the Optimize function was activated.

After our recommended Optimize features are enabled.

If you are not sure which settings to select, we recommend activating CSS Minify, CSS HTTP/2-push, JS Minify, JS HTTP/2-push. Activating CSS Combine, JS Combine can result in scripts and CSS failing.

After you have activated any options or made any changes in the plugin, you should check that your website is working as normal. If you are experiencing problems with the Combine function, but still want to activate this one, you should check out “How to fix problems caused by CSS/JS optimization“.

When activating HTML Minify the source code will not be easy to read should you need to later. All code will be “pressed together” to save resources. It is still recommended to activate this one. Under the same function you will see Inline CSS Minify and Inline JS Minify. These will remove any spacing, sections and comments in all CSS- and/or JS-files.

Load CSS Asynchronously is a function that will make sure CSS and HTML are loaded simultaneously. As a standard CSS is always loaded first so the website will be displayed correctly as soon as it loads. By activating Load CSS Asynchronously, the website will load faster but could give your visitors a bad impression since they will be able to see your website without images and CSS for a second. We therefore recommend you also activate Generate Critical CSS. This will connect to LiteSpeed’s Critical CSS server which will insert the necessary CSS, so your visitors will not see a lesser version of your website. We also recommend to activate Generate Critical CSS in the Background which makes sure the website is loaded automatically in the background and caches ready for when a visitor will want to see the website as fast as possible, without errors.

Load JS Deferred will make sure all scripts are loaded according the HTML-code. Activate this and test your website. If you are experiencing any errors, you should activate Exclude JQuery and try again.

DNS Prefetch is not mentioned in this article but if you are interested you can read more in “X-DNS-prefetch-control“.

The final option in Optimize is “Remove Comments” meaning comments or scripts typically deactivated by */ or //. These will automatically be removed in the cached version of the website and can in many cases contribute to faster load.

The settings in the Optimize tab can make a big difference to increase the speed for your website. When activated. this function will replace any other plugins (for example Autooptimize) within minify-options.

Tuning (tab #6)

Combined CSS Priority and Combined JS Priority only needs to be activated if you are experiencing problems with your design after activating the options from Optimize.

Remove Query String makes sure a website with different possible strings behind the URL is ignored and only the website shown is cached.

An example could be:
exampledomain.org/product/ball
exampledomain.org/product/ball?colour=yellow
exampledomain.org/product/ball?colour=pink

Without Remove Query Strings all these sites will be cached even though it’s the same site as the visitor is currently on. When activating Remove Query String, they are ignored, and resources are saved since only exampledomain.org/product/ball is cached. You can read more about this and see examples on LiteSpeed’s blog.

If you are using Google Fonts, you can load these quicker by connecting to Google servers before the actual load of the website starts. Use Load Google Fonts Asynchronously. Remove Google Font will remove any external fonts loaded from Google. If you are unsure if you need these options, you can check your website after activating and see if it works better.

We will not be looking into rules/excludes as this is highly advanced.

Remove WordPress Emoji will reduce the number of requests from your website. We recommend this since you can use standard emojis if needed.

Media (tab #7)

We will leave Lazy Load Images remain inactivated since this is a function you alone should consider if you need. Perhaps not everyone will need this, but it will save resources when it comes to loading the website, but remember you need to satisfy both visitors and search engines.

Optimize Automatically we recommend activating as this will activate optimization of your images. We also recommend activating Optimization Cron, Optimize Original Images, Optimize WebP Versions, Optimize Losslessly and Image WebP Replacement.

After activating these, you can click “Image optimization” under the options for LiteSpeed. You will have an overview of how much space you have saved and a que of how many images being optimized.

As an example, we have uploaded an image of 1,4MB which was already optimized by a third party, after a few minutes of processing in the background, I got an 8% less image file size. With standard settings you will not see any noticeable changes to the image.

CDN (tab #8)

In this tab we will insert CloudFlare’s API at the bottom of the page, since the website is using CloudFlare nameservers. If you are not using CloudFlare (or any other CDN) you can ignore this. You do not necessarily need CDN if your target group is in Norway and you are located on a Norwegian server. CloudFlare has many other interesting functions included in our web hosting. If you are expecting a lot of tragic from abroad, you should use this.

Regarding Load JQuery Remotely you should only activate this is your visitors are from other countries than Norway since both Google and Cdjns can retrieve this from foreign servers. Analytics sites will also consider this as external requests.

ESI (tab #9)

If you are not sure what ESI are, you can read more about this is “Wpw: Private cache vs. public cache”.

In short terms this is a function within cache, displaying different cached websites for different roles (guest, admin). We recommend activating this in addition to Cache Admin Bar and Cache Comment Form.

Vary Group settings do not need to be altered, unless you have a web shop with different prices displayed according to role (for example retailers seeing different prices than private parties).

Advanced (tab #10)

The only option we are going to activate is Browser Cache with a TTL of 1296000. You can also leave the standard values as is. Browser Cache stores logo, images and fonts locally on visitor’s units so they will not need to load this every time they visit the website or any other of your links. Most static files that is rarely altered will be stored. TTL do not need too be to high as you will sometimes change the content. Anything from one day in seconds to one month is fine.

We will not be looking into Object Cache as this is highly advanced.

Debug (tab #11)

If you suspect any errors on your website is caused by LiteSpeed, you can activate “Disable All Features”, store and then check your website (remember to deactivate after).

In this tab you can also alter how much information is logged. You can deactivate ADMIN-AJAX by deactivating “Heartbeat”. You should not do this unless you have a valid reason.

Crawler (tab #12)

Currently only Enterprise servers have this function available, so we will leave this out of the article. If you are interested, please contact us and we will help you select the best web hosting.

WooCommerce (#13)*

In this tab we have activated all options and left Product Update Interval remain on “Purge Product on changes to the quantity or stock status. Purge categories only when stock status changes.”

* You will only see this if you have the web shop module WooCommerce installed and activated.

Summary

If you wish to be located to a LiteSpeed webserver please follow instructions in “Change web hosting server”. If you wish to upgrade in order to move to a LiteSpeed webserver please follow instructions in “Upgrade services”.

Please feel free to contact us for advice or recommendations.