https://help.superhosting.bg/en/supercache-wordpress-speed-up.html
  • bg
  • en

Hosting, Domains, Cloud, Virtual Private Servers (VPS), Managed VPS, SSL Certificates

How to Set Up SuperCache for WordPress

WordPress
wordpress supercache, supercache wordpress, super wp, wp super, wp cache

This is a guide for the specific SuperCache configuration when activated for a WordPress website. Activating SuperCache is the same for all kinds of websites no matter what CMS they use. However, the settings can be specific for each separate website. They differ mainly because of HTTP cookies and/or HTTP headers.

In this article you can read more about the special features you need to consider when activating and setting up SuperCache. At the end of each section we have described what you need to check to know whether you have to change anything in the default settings.

When setting up SuperCache, first check the caching status to determine if the web content is being cached.

info-iconNote: You can immediately activate SuperCache in cPanel but you need to make sure upfront that there are no plugins or themes using HTTP cookies. WooCommerce is such plugin as its shopping cart uses HTTP cookies and it should be excluded from caching.

SuperCache Default Settings link-to-this-section

After SuperCache is once activated in cPanel, website caching starts working in the following way:

  1. Automatic cache purge is performed every 15 minutes. This setting can be changed under Advanced Settings and then Automatic cache purge.
  2. HTTP Cookies: The website will display cached content to all visitors no matter if there are HTTP cookies generated. This SuperCache feature is accessible under the Advanced Settings section Types of caching when using cookies and the option Cache everything.
  3. HTTP Headers: SuperCache conforms to the HTTP headers Expires, Cache-Control, Set-Cookies and Vary which are available in the website’s response. You can modify this SuperCache feature by going to the Advanced Settings -> Disable the processing of the following server headers and Ignored Vary headers sections.
  4. SuperCache contains automatically added URLs excluded from caching such as wp-adminwp-login.php and others. You can disable or enable caching by going to the Advanced Settings -> Automatically added URI addresses which are not cached.

WordPress Features Excluded from Caching link-to-this-section

Admin Panel

Administrative access and the system panel of WordPress should be excluded from caching.

WP recognizes and tracks logged in users as they receive the following HTTP cookie: wordpress_logged_in. Administrative access is normally available only at a specific website address: /wp-admin (wp-login.php).

info-iconImportant: Caching with SuperCache automatically excludes the cookie for a logged user and the administrative panel URLs in WordPress.

Password Protected Articles/Pages

Caching with SuperCache also excludes these. The system cookie WordPress uses after identifying wp-postpass_ is also automatically disabled from caching.


What to do?
  1. Main password protected system features in WordPress such as admin panel and articles are also automatically excluded from caching. You do not need further SuperCache setup for these two features.
  2. If you have enabled comments on posts you can exclude the comment_author_ cookie from caching. Go to the SuperCache Advanced Settings section -> Types of caching when using cookies and select from the drop-down menu Cache everything excluding specific visitor cookies. Then enter the comment_author_ cookie in the field Do not serve content from the cache when a cookie is present.

WordPress Plugins and Themes link-to-this-section

By default WordPress does not use other than the system cookies wordpress_logged_inwp-postpass_ and comment_author_.

info-iconImportant: If the website is using other HTTP cookies, different from the system ones they are most certainly received from additionally installed plugin or a theme.

What to do (plugins and themes)?
  1. Check what types of cookies are generated from your website.
  2. Go through the biggest possible number of pages / features on the website.
  3. If there are cookies different from the WP system ones, check which plugin or theme generates them.
  4. You will have to decide whether to disable caching for them. If the cookie is used for a specific feature which makes the website’s content unique for each visitor, it should be excluded from caching. An example of such a cookie is the one from WooCommerce plugin which is generated when a user adds products to their shopping card.

info-iconNote: After a WordPress installation or plugin deactivation you need to recheck if caching is still running smoothly. It is possible for a newly installed plugin or a theme to modify the served HTTP headers concerning the caching process. New HTTP cookies might be set as you need to take them into consideration and configure SuperCache again.

WooCommerce link-to-this-section

WooCommerce is usually automatically configured so that it works properly when caching systems are used.

However, it is possible that other installed WP themes and plugins influence the store’s proper behavior if there are caching systems. Therefore, SuperCache also allows for a few additional settings.

What to do?
  1. Exclude certain store addresses from cachingExclude the online store’s sensitive data (URLs) from caching. These are the URLs for the shopping cart, payments as well as the customer account. Their default URLs are: /cart, /checkout, /my-account but they might be different/customized for every store.
    In the SuperCache Advanced Settings -> Exclude URL addresses from caching copy these URLs the way they are setup in your store.
  2. Exclude your store's sensitive cookies from caching. In the Advanced Settings for Types of caching when using cookies select Cache everything excluding specific visitor cookies. In the Do not serve content from the cache when a cookie is present fields enter the following cookies - woocommerce_cart_hash and woocommerce_items_in_cart. Turn off caching for specific store cookies
  3. In case you use the WooCommerce widget Recently Viewed Products which is visible on all of the store’s pages, it is possible for a user to start seeing the products viewed by other users. Other option is excluding the woocommerce_recently_viewed cookie from caching as this will also slow down or even disable the acceleration of your website. Third option is, if possible, to deactivate the Recently Viewed Products widget in the store.

W3 Total Cache link-to-this-section

This plugin goes for a few types of caching for your WordPress website. All W3 Total Cache caching options here are compatible with SuperCache.

1) What to do? (General Settings -> Reverse Proxy)
  1. URL address for automatic cache purgeCopy this URL from the SuperCache home page in cPanel. Copy only the IP along with the port without the http:// part.
  2. Настройка за автоматизирано изчистване на кешираната информацияGo to the W3TC plugin settings: Performance -> General Settings -> and enable Reverse Proxy caching via varnish (1) then enter the URL (IP:Port) to the Varnish servers field: (2).
  3. After you save the settings, the cache will be purged within each new change of the website’s content (e.g. editing or posting).
    Thus you will see the changes on your website immediately.
    If you have also activated some of the W3TC caching options you might need to additionally purge the cache from the plugin.

This plugin controls the served HTTP headers (Cache-Control, Expires, Last-Modified, ETag) related to caching the website’s resources. Settings are accessible under the Browser Cache section. After the initial plugin activation, all settings in Browser Cache are automatically set by default and you do need to change them. You can check what headers are served by the website just in case. It is possible that other installed themes or plugins influence the HTTP cache headers for the website.

2) Additional HTTP Headers Setup (Browser Cache)
  1. The Browser Cache settings are divided into four sections according to the type of web resources: General, CSS & JS (.css, .js scripts), HTML & XML (articles/pages, feed) and Media (media and other files).
  2. Activate Enable HTTP (gzip) compression, Disable cookies for static files and Set Last-Modified header in the General settings section. This will also enable settings for all other sections (CSS & JS, HTML & XML, Media).

In case the website generates the Expires and Cache-Control headers, activate the following features for General: Set expires header and Set cache control header. For these two headers to work properly, the .htaccess file should not contain directives of mod_expires out of the W3TC section (from # BEGIN W3TC Browser Cache to # END W3TC Browser Cache).

Wordfence Security link-to-this-section

This plugin uses multiple cookies by default to perform really useful functions. One of the cookies used is (wfvt_*) generated within every hit to the website. This means that the Set-Cookie header is available in each of the website’s responses. This behavior disables any possible website caching. Excluding Set-Cookie from caching in SuperCache is not a good idea. But the Wordfence Security offers a setting for disabling cookies.

What to do?
  1. View the three specific features that will be disabled in case of disabled cookies:
    https://docs.wordfence.com/en/Wordfence_options#Disable_Wordfence_Cookies
  2. In case you do not really need these features, disable cookies from this plugin from its settings in WordPress: Wordfence -> Options - Advanced Options and then select the: Disable Wordfence Cookies option.

View/Hit Counters link-to-this-section

Plugins using a POST query or AJAX for counting visitors will work properly as every hit will be counted. The real time visitors can be tracked through the WordPress administration as caching has been automatically disabled there.

However, a real number of hits cannot be displayed on the website itself. For example for displaying the post hits using a widget. The reason for this is that after the page’s HTML code is cached, it is not modified in the customer’s browser. To see the real time number of visits to a cached webpage when its’ accessed you need to further develop the counting system which may mean reworking the code and the plugin implementation path.

For up-to-date and accurate data on the website’s hits we recommend using Google Analytics or a WP plugin that works with AJAX for counting hits. Plugins that support AJAX are:  AJAX Hits Counter + Popular Posts Widget, Post Views Counter and others.

  • To count a visit, the tool must use either POST query or JavaScript/AJAX.
  • When a POST query is used, but the counter does not have a separate file for this purpose this might make the cache inefficient since the WP will be launched and executed for every hit despite the SuperCache activation.
What to do?
  1. If you are using a plugin to count visits, check its settings and if possible enable JavaScript/AJAX.
  2. Exclude from caching the directory of a pluginExclude the plugin directory from caching in the SuperCache settings. Once the plugin is installed, check its directory and path to the hosting account. For the Post Views Counter plugin, the path is: wp-content/plugins/post-views-counter. Go to the Advanced Settings in SuperCache and add this path to the section Exclude URL addresses from caching.
  3. If you need recent data on the hits you can use Google Analytics. After you create an account in Google Аnalytics you can install additional plugin in WordPress to receive data about hits directly in the WP admin panel. Such plugins are: Google Analytics Dashboard for WP (GADWP), Google Analytics for WordPress by MonsterInsights and others.

500px270px
SuperHosting.BG

Comments

Be the First to Comment!

Notify of
avatar
wpDiscuz
All rights reserved © 2005-2017 , www.superhosting.bg