Improve Performance with Litespeed Cache WordPress Plugin

In a previous post on our blog we discussed the idea of using the LiteSpeed page caching feature to improve performance of WordPress.  The caching drastically improved the performance of a WordPress installation.  You were able to go from just over 200 requests/sec to 1800 requests/sec with just a simple htaccess line.  The LiteSpeed team have however worked on making it even easier to accomplish this with the introduction of their LiteSpeed Cache plugin for WordPress.  With this plugin you have further control over your caching policies and can utilize a simplified htaccess mod_rewrite rule.  I’m going to quickly go through how you install and configure the WordPress LiteSpeed cache plugin.

The initial step of course is to install WordPress which you can do through cPanel using Softaculous.  There is no need to work with the cPanel file manager or an application like FileZilla.  Just a few clicks and your WordPress is installed.  Which now leads us to the point of this post is just how to install the LiteSpeed Cache plugin.

Step 1

The LiteSpeed cache plugin requires that you’re not using the plain permalinks option.  You can change this by going to WordPress your admin interface and then ‘Settings => Permalinks‘.  In most cases WordPress blogs are setup to utilize day and name but you can set them to any of the options and save the changes

permalinks

Step 2

You are now ready to install the LiteSpeed cache plugin.  You can do this by logging into your WordPress admin interface then going to ‘Plugins‘ and clicking ‘Add New‘.  On this page put in Litespeed in the search bar and you’ll see the LiteSpeed cache plugin appear

Install Litespeed Cache

You’ll then click the install now option which will install the plugin.

Step 3

Now that it’s installed you need to activate the plugin.  You can do this in your WordPress admin interface by clicking ‘Plugins’ and then ‘Installed Plugins’.  On this page you should see your list of plugins including the LiteSpeed Cache plugin.  Click the activate option to activate the plugin.

Activate Litespeed Cache Plugin

Step 4

You will now see a settings option for the LiteSpeed cache plugin which you’ll click so you can start configuring the plugin.  On this page you’ll be able to set the cache TTL, frontpage TTL, separate mobile caches and various other options.  For most users the settings should be fine and you can just save the changes.

Step 5 (No Longer Necessary)

This setup is no longer necessary the plugin does this automatically for you.

You now need to let our web servers know you’re utilizing LiteSpeed Cache.  You do this by modifying your .htaccess file and adding the following to the top:

<IfModule LiteSpeed>
CacheLookup public on
</IfModule>

The easiest way to do this if you’re not familiar with utilizing FTP or SSH is to use the cPanel file manager.  Once you’re logged into cPanel you’ll go to ‘File Manager’ then navigate to your public_html folder.  You’ll notice the .htaccess file is not there this is because by default cPanel hides hidden files.  You can change this by going to your file manager settings and checking off ‘Show Hidden Files’ and clicking save

cPanel Filemanager Show Hidden Files

You can now select your .htaccess file and select to edit it which will open the file editor for it.  Then all you need to do is add the LiteSpeed cache code to the top of the file.  After this your file might look something like this:

<IfModule LiteSpeed>
CacheLookup public on
</IfModule>

<IfModule LiteSpeed>
RewriteEngine on
###LSCACHE START RESOURCE###
RewriteRule wp-content/.*/(loader|fonts)\.php - [E=cache-control:max-age=3600]
###LSCACHE END RESOURCE###
###LSCACHE START FAVICON###
RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
###LSCACHE END FAVICON###
</IfModule>


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

You’ve now completed the installation and setup process of LiteSpeed Cache on Hawk Host and it’s time to take advantage of the speed increase.

This entry was posted in General, Tips and tagged , , , . Bookmark the permalink.

17 Responses to Improve Performance with Litespeed Cache WordPress Plugin

  1. Binod J. Bogati says:

    Recently I’ve installed LiteSpeed Cache , I can feel improved page speed than the previous WP-Super Cache. Page speed drastically changed, I got my TTFB faster than 200ms and got no any warning from Google pagespeed insights.

  2. wisata says:

    wow new features. Thanks for hawkhost. I will try this plugin to my wordpress blog

  3. Hello,

    Can i use permalinks home/%postname%/
    After install litespeed cache plugin, can i install w3 total cache too?
    Because i like this plugin (w3 tc) to manage theme for mobile view

  4. Tony Baird says:

    You can use any permalink structure it should work. As for mixing multiple caching plugins this is not recommended. Litespeed Cache plugin supports mobile specific views in it’s settings. Enabling both plugins would just result in you creating w3 total cache pages which would never get used as the Litespeed cache pages would be used.

  5. Robert H. Oliver says:

    I have a issue with W3 total chace and thrive visual editor. How can I solve this?

  6. Kris says:

    Interesting, I want to try it 🙂

    Btw, LiteSpeed Cache vs W3TC, which one is better?

  7. Muhammad A says:

    Thanks Tony.

    In one of the comments you said we don’t need to use another Cache Plugin when Litespeed Cache is turned on. Without W3TC how can we use Memcached? (and does memcached provides any benefits when Litespeed Cache is on?)

  8. Tony Baird says:

    Litespeed cache would be better than W3TC more than likely although it be pretty close if you’re using page caching of w3 total cache.

    If you’re using Litespeed Cache there is absolutely no reason you’d even want to be using memcached with w3tc. The reason being if memcached is being used that means PHP was being used. Even with memcached it’s still going to be slower than Litespeed Cache or W3 Total Caches’s page caching method. My recommendation would be turn off W3 Total Cache and your Memcached instance and just use Litespeed Cache.

  9. Muhammad A says:

    Thank you Tony.

    I did on two sites and server loads reduced.

    May be because W3TC itself eats up quite few resources every time WordPress loads.

    No need to have a cache plugin. This is cool.

  10. Peter says:

    I have wp rocket onto my website, can use together with litespeed cache?

  11. Puisi says:

    Hi, how to check if LSChache plugin is working correctly?

    thank you !

  12. Jack says:

    Hi, guy,
    I think there should be some update for this post
    Once I installed the Litespeed plugin, I got the following code :
    It seems that you don’t need to perform the Step 5 now. The plugin adds CacheLookup Public on by itself.

    ###LSCACHE START PLUGIN – Do not edit the contents of this block!###
    RewriteEngine on
    CacheLookup Public on
    ###LSCACHE START RESOURCE###
    RewriteRule wp-content/.*/[^/]*(loader|fonts|\.css|\.js)\.php – [E=cache-control:max-age=3600]
    ###LSCACHE END RESOURCE###
    ###LSCACHE START FAVICON###
    RewriteRule favicon\.ico$ – [E=cache-control:max-age=86400]
    ###LSCACHE END FAVICON###
    ###LSCACHE END PLUGIN – Do not edit the contents of this block!###

  13. Tarun Kumar says:

    is this plugin support json api ?

  14. Vy Spirit says:

    I using WP Rocket and happy about it.
    Should I switch to Litespeed cache? Which one is better?

  15. Tony Baird says:

    @Jack

    We’ll update the post as at the time of the writing of this post the plugin did not do this. We made a feature request and the Litespeed team implemented it.

    @Tarun Kumar

    Not sure what you mean it can cache any pages. Or do you mean if it has it’s own JSON API?

    @Vy Spirit

    The advantage is the Litespeed cache with us is free of charge. It is compatible with most major plugins and it is at least as fast if not faster than any other caching plugin. This is a web server based caching while others rely on serving static files to the users.

  16. Puisi Cinta says:

    Thanks for your information about improve performance with litespeed.

    it’s clearly enaugh.. 😀

  17. Ivan Panchev says:

    I already use it for all of my websites and performance is really good.
    It’s better than others standard caching plugins – W3TC, WP Super Cache, etc.

Leave a Reply

Your email address will not be published. Required fields are marked *