How to Optimize a website with LS Cache (LiteSpeed Cache)
Every day when a website is being released in the world of web development and design, not only people aim for acquiring the first place on the first page, but also optimize their website for speed.
Aside from writing many blog posts or having the best functionality with your plugins, you also need to have a plugin configured to cache and serve cached pages.
If you haven’t already heard, speed is all that matters for users to come to your website.
It doesn’t matter if you have the best article, which would catch each visitor’s eye, because a website that takes more than 3 seconds to load will not be visited often.
In fact most of the websites are loaded through mobile phones, which means that it takes a bit more effort to setup an effective caching and achieve the under 3 seconds loading rule.
Over the years people have switched to their mobile devices and tend to read much more, as smartphones can be taken anywhere and at any time.
If your website is not optimized for mobile users, you will be missing a lot.
This guide is self made and differs from most of them. It is not sponsored and will not slow down your website like WPCrafter’s guide.
LS Cache vs WP Rocket vs W3 Total Cache Comparison
Depending on your liking or plugin that you are willing to use, we have made this article, so you can find help for any of the top caching plugin such as W3 Total Cache, LiteSpeed Cache (LS Cache) and WP Rocket.
Apart from the other plugins, LS Cache is having the option to optimize your images, which can save time and resources for downloading plugins to do the job for you.
They also offer an image transformation to WEBP format, which saves a ton of space on your website and reduces its page size significantly.
WP Rocket is another well known plugin that can save your time, with beginner friendly set of options and lets you easily configure how your website should be cached, which is critical for newbie users.
Apart from the settings, which are almost mutual to LS Cache, WP Rocket has an easy option to combine and minify the JS, which your website is using, without damaging external JS scripts.
If you are unsure how to do it, you can just follow this simple guide on how to setup WP Rocket to speed up your website.
These scripts are known as Google Analytic Scripts, Google Adsense Ad scripts and Media.net Ad Scripts.
In order to configure LS Cache to not combine and minify these external scripts, you can turn off the option, or exclude the scripts that should not be fetched by the option.
W3 Total Cache is another significant life saver plugin, but has the hardest configuration for newbie users and can easily break your website.
It’s structure and set of options is similar to LS Cache and WP Rocket, but the way your options are explained is a bit tricky.
Not only you should be careful not to break the HTML, CSS, JS or your internal PHP calls, but you should also pay extra attention how you are configuring CloudFlare.
For those of you, who have not heard about CloudFlare, it is a CDN, which can be used in various ways.
You can minify your websites HTML, CSS, JS.
Accelerate your website speed with their Rail Gun option.
Set a list of Workers who will take care of the speed for you.
Configure page rules, but can be risky as your plugin may do the same and result in conflict.
Cache and serve your website through any point in the world, without resulting in tons of loading times.
If we had to choose between LS Cache, WP Rocket and W3 Total Cache, our top pick would be LS Cache, due to the QuicCloud CDN and our technical skills.
But these 3 plugins compared to each other are all special in their own way.
As you can see LS Cache can handle more Requests per Second, while WP Rocket stands on second place, but WP Rocket does not need a LiteSpeed web server configured to work for you.
Even though W3 Total cache is having less requests that WP Rocket or LS Cache, it is more reliable and better used with a CDN and less risk of having 2 settings doing the same and creating conflicts.
Optimize website with LS Cache
The setup provided for LS Cache is currently our setup and is perfect for people who serve ads, without the need of excluding any type of script.
You can still change your options however you like, but keep a copy of the configuration just in case, if you get lost configuring.
Enable Cache – The trigger of the Cache option
Cache Logged-in Users – You do not need to have this option enabled as you need to see the latest updates on your website. In case you have a user membership plugin, you can turn this plugin on.
Cache Commenters – Caching commenters is not recommended as you will be caching comments anyways.
Cache REST API – Caching REST API is not recommended for users who have certain API integrations.
Cache Login Page – Caching login page is not needed as your login page never changes, but if you have a dynamic login page, you can always enable this option.
Cache PHP Resources – Caching the PHP resources is mainly depending on your WordPress theme, but problems have not occurred until now.
Cache Mobile – Caching the mobile page is recommended only if you are using the WordPress AMP plugin as this option is suited for it. It does not work for mobile friendly themes without AMP.
Default Public Cache TTL – 2592000 (Can be left as Default too)
Default Private Cache TTL – 3600 (Can be left as Default too)
Default Front Page TTL – 2592000 (Can be left as Default too)
Default Feed TTL – 2592000 (Can be left as Default too)
Default REST API TTL – 2592000 (Can be left as Default too)
Default HTTP Status Code Page TTL – Leave as default
Purge settings should be left as they are on default, but you can also make some changes as to purge:
- All Pages
- Front Page
- Home Page
- All pages with Recent Posts Widget (Recommended for dynamic widgets)
- Author Archive (If you have one)
- Post type archive (recommended)
Excludes can be left as they are, except if you know what you are doing.
Even though the purpose of LiteSpeed Cache is to optimize your website to its fullest, we still do not recommend running into this, except if you have the URL’s you want to exclude.
Turning off your ESI settings is beneficial no matter what.
ESI may interact in a really bad way with your website, causing problems with caching and serving.
Note that if you have ESI turned off, the other options will not operate even if they are turned on.
Depending on your hosting plan, you should have Memcached and Redis extensions by default.
If not, you can ask your hosting provider to install them for you, as you will need them for object caching.
Object cache – Should be always turned on and have your Redis Extension installed in your hosting plan.
Method – Method should be chosen as Redis Extension and should be Enabled.
Host – The IP address of the Redis extension. You can find it once you create an instance in Redis.
Port – The port address, which is shown in Redis. You can also find it once you create an instance in Redis.
Default Object LifeTime – Can be left as default.
Username – The Redis username is provided by your Redis extension upon creating instances. It’s not always needed, so do not panic.
Password – The password is acquired through the Redis extension upon creating and instance.
Browser Cache – Stores all the static files locally, so users do not have to download your website’s information all the time. Saves space and improves speed.
Browser Cache TTL – Can be left as default.
Advanced Cache Settings
These settings can be left turned off and blank, as they may result in conflicts with different users.
Login Cookie – Sets a cookie, which can check if the user has already downloaded the website content, as different links exist.
It is still not used by our side, because it may generate more cookies than usual and mess up the user experience.
Improve HTTP, HTTPS Compatibility – If your website is loading both HTTP and HTTPS files this option may be perfect for you.
As another example I would say when visitors try to access your website through the HTTP version, they will get redirected to the HTTPS one.
Still this option resulted in conflicts for us, but you can use it.
QUIC.cloud CDN – If you want to register or have a registration on QUIC.cloud you can turn this option to use it
USE CDN Mapping – Using CDN mapping is not recommended as the usual CDN’s that you will be using are CloudFlare and Quic.cloud. They do not use CDN Mapping and could cass errors.
CDN URL – This is the URL that will be used when serving images and other elements.
CloudFlare Integration should be ON. A username and password are also needed to be integrated with LS Cache
Image Optimization Settings
Auto Request Cron – Automatically request images to be optimized rather than manually optimizing them.
Auto Pull Cron – Pull all images through Cron.
Optimize Original Images – Optimize your already existing images (saves a ton of space).
Remove Original Backups – Normally we wouldn’t recommend this, but if your hosting plan is limited on space, you can turn this option ON.
Optimize Losslessly – If you already have a plugin, which is optimizing your images Losslessly it is not recommended to turn this option on.
Remove EXIF/XMP Data – With this option you can reserve your pictures so they are not used, but will result in increcement of space.
Although it would be good to preserve images, you never know if you actually own copyrights.
Does not apply for photographers, which create their own pictures and not use Stock Footage.
Create WebP Versions – Changes your images format to WebP, which results in faster loading times and drastically reduces the image size.
Image WebP Replacement – Replaces current images, which have different format to WebP, which helps with faster website loading times.
CSS Minify – Minifies existing CSS files. You may see style.min.css, which is the idea to save resources.
CSS Combine – Combines existing CSS into one file in order to reduce many repetitive requests.
CSS Combine External and Inline – Combines and Inlines all css files into one. Servers both from the website and out of the website CSS>
CSS HTTP/2 Push – If your browser supports HTTP/2 Push, this option helps with receiving the CSS before anything else. Fixes the error for seeing plain HTML.
Load CSS asynchronically – Loads CSS before HTML, which helps with seeing the real pattern of the website.
Generate Critical CSS – Leave this option ON as it will generate critical CSS through Quic.cloud in the background for faster speed.
Generate Critical CSS in the background – Leave this option ON, as it will help with generating the CSS in the background.
You can Exclude this as an option in the Tuning tab.
JS HTTP/2 Push – Optimizes the JS, but needs the HTTP/2 Push protocol supported by your browser.
Load JS Deferred – Reduces the resources cost and improves website speed
Local Inline JS – Localizing and inlining the existing JS should be Deferred, as it can help with website speed.
CSS/JS Cache TTL – CSS/JS Cache Time to live should can be left as default, but we use 2592000s
HTML Minify – Can be turned ON as it will not make any conflicts.
DNS Prefetch Control – Prefetches your resources and helps on improving website loading times. Keep turned ON
Remove Query Strings – If you use Google Captcha or anything similar, this option should be turned OFF
Load Google Fonts Asynchronously – Loading Google Fonts Async helps with using the preloading option, which you get when extracting fonts to your website. Keep it ON.
Remove Google Fonts – Since your website is using Google Fonts it would be a good idea to keep this option OFF. If you are not using Google Fonts, there is no reason to keep it OFF and can turn it ON>
Remove WordPress Emoji – Removes the WordPress emojis, which no site uses anymore. This can help with improving the site speed
Remove Noscript Tag – Should be kept ON as it will remove unnecessary tags.
The rest of the options can be kept by default and do not need any touch.