What is a domain?

/What is a domain?

WordPress caching settings

When you set the PHP and caching settings in your cPanel and WordPress website correctly, you will experience a better performance. Your website is not only much faster, but it also process much more traffic simultaneously. This functionality is included, free of charge, and you can set it up yourselfby following the steps below. Below, you will find a step by step explanation of what caching is and how to apply it for WordPress sites hosted on Hoasted in an optimal manner.

What is Caching?

A cache is a part of the server memory. Recently saved and / or frequently used information are stored here. When a web page is requested, all components are invoked from the website (database, PHP scripts, images, CSS files, etc.), and a result of all scripts will be shown. Through that process, which has a short duration (average between 200 ms and 3 seconds), all PHP scripts are invoked and calculations re-performed.

When a site is cached, this means that only the result (the cache) of the scripts is displayed (your site will be served from the cache). This is a very efficient way to make your website very fast. For example, if you receive 10 website visitors at any given time, the website is loaded normally to the first visitor and then immediately put into the cache. For the next 9 visitors the website will be loaded from cache, making the loading time much shorter.

The cache of your website or webshop is automatically recreated when a user makes a change in the web site.

Step 1: cPanel settings

  1. Login to the cPanel as admin
  2. Go to ‘Select PHP version’ under Software > SELECT PHP VERSION
  3. Tick the OPCACHE + APCU boxes if these are not ticked as yet.
  4. Click on ‘Save’

WordPress caching settings

Step 2: WordPress settings

  1. Before you start optimising it often makes sense to do a number of benchmark tests, so you know for sure if the performance has improved. You can use the following tools for that purpose. Be ware, you can often choose a location from where to test it. Choose a location as close to Amsterdam as possible for accurate results. https://www.webpagetest.org/– https://tools.pingdom.com/– https://gtmetrix.com
  2. Login to the WordPress installation
  3. Be ware: remove all existing caching and optimalization plugins.
  4. Make sure your .htaccess file is clean (only the basic WordPress .htaccess content as below) and no caching configuration remains there. Usually only the following is left and perhaps a redirect rule for SSL:
    # 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
    
  5. Install and activate the plugin “LiteSpeed Cache” (https://wordpress.org/plugins/litespeed-cache/). If the plugin is installed correctly, you will see ‘LiteSpeed Cache’ in the WordPress admin menu on the left.
  6. If the plugin is installed, open a Chrome Incognito Window (Windows: Ctrl+Shift+N, Mac: Cmd+Shift+N) en visit your website.
  7. If you use Woocommerce it is not necessary to exclude pages, even though it makes sense to test it. Only when using custom functions we notice sometimes an issue.
  8. Default the LiteSpeed Cache settings are fine already. In case you want the maximum result however, go to LiteSpeed Cache > Configuration > Advanced view, everything default except:

    [5] Optimize:
    CSS Minify > ON (Test it carefully for eventual conflicts, otherwise Off)
    Inline CSS Minify > ON (Test it carefully for eventual conflicts, otherwise Off)
    CSS Combine > ON (Test it carefully for eventual conflicts, otherwise Off)
    CSS HTTP/2 Push > ON
    JS Minify > ON (Test it carefully for eventual conflicts, otherwise Off)
    Inline JS Minify > ON (Test it carefully for eventual conflicts, otherwise Off)
    JS Combine > ON (Test it carefully for eventual conflicts, otherwise Off)
    JS HTTP/2 Push > ON
    HTML Minify > ON (Test it carefully for eventual conflicts, otherwise Off)
    Remove Comments > ON (Test it carefully for eventual conflicts, otherwise Off)[6] Tuning:
    Remove Query Strings > ON
    Remove WordPress Emoji > ON

    Advanced
    Browser Cache > ON

    The minify/combine depends very much on which theme / plugins you use and whether these are programmed well. Especially test whether all JS and CSS work fine after using Minify, as you need to test every option whether it works well and otherwise disable it. The object caching can best be Off. We rarely see any cases where this really adds speed and for this you have to subscribe to a special service.

  9. Load the home page for the first time in your Incognito window. It will take a little longer as all cache is now empty.
  10. Do all benchmark tests again and check the difference in speed, especially whether  the “Time to First Byte” (TTFB) is faster. LiteSpeed takes above all care of optimisation in the TTFB.
  11. When the above items have been accomplished, the optimisation is finished!

Be ware: If you have made changes in your website and you want these to be instantly visible for all users you have to empty the LiteSpeed Cache. For that you have to log in in your WordPress Dashboard, click LiteSpeed Cache and choose Purge All:

2018-09-28T12:00:58+00:00 juli 18th, 2018|Developers|Reacties uitgeschakeld voor WordPress caching settings
Hoasted support

How can we help you?

We want you to ask us questions, because we love to help you in accomplishing your goals. We let no questions unanswered, provide you with high speed responses and leave no problem unsolved. What is important to you, is important to us. Shoot us a message and see for yourself.