Share

If you’re researching this topic for the first time, we recommend starting with our initial article – A Beginner’s Guide. Due to the sheer number of potential server setups out there in the wild, out of necessity, we will be sticking to an overview of some of these advanced options as we dive a little deeper rather than getting into detailed configurations.

In this second part of our overview of the W3 Total Cache (W3TC) plugin, we’re touching on some of the more advanced options available.

Overview

A Summary of The Beginner’s Guide

Let’s begin with a brief recap of what was covered in the beginner’s article.

  • Why use the W3 Total Cache (W3TC) plugin?
  • Requirements and installation.
  • Plugin setup guide and features.
  • Alternative cache plugins.
Plugins

The beginner’s article is an introductory overview of using the W3 Total Cache (W3TC) plugin to enhance website performance. We explain the importance of caching for improving page load speeds and overall user experience, detail the initial setup and installation requirements, and highlight the plugin’s key features. The guide is intended to help new users effectively implement W3TC to optimize their WordPress sites

Page Cache

The Page Cache feature creates static cache files for each page and posts on your website, storing them in the server’s memory or disk (depending on the settings). When a page is requested, the server delivers the pre-generated HTML file instead of processing the heavier WordPress PHP scripts each time. This significantly reduces server load, decreases response times, and can significantly improve speed for websites with high traffic or dynamic content.

Page Cache is highly effective for websites with dynamic or primarily static content, like eCommerce stores, discussion forums, blogs, or news sites, where changes to existing content are only occasionally made.

Basic Settings

Utilizing page cache can significantly enhance your website’s speed, especially when evaluating Time to First Byte (TTFB). TTFB represents the duration between a user accessing your website and your server delivering its initial response.

Here, you enable page caching and choose the page cache method depending on whether you are using a shared server, dedicated/virtual server, or multiple servers.

Page Cache Basic Settings

Advanced Settings

1: General

The options listed on the General Settings page are related to your website’s homepage display settings. Your homepage display settings are managed in the WordPress Dashboard > Settings > Reading section.

General Cache Settings

2: Aliases

The plugin optimizes cache utilization by recognizing alias hostnames, improving website performance and user experience across various domains or subdomains. This is particularly useful when identical WordPress content is accessible from multiple domains, and the cache engine will treat them as equivalent for caching purposes.

Cache Aliases

3: Cache Preload

The option allows for automatically priming the page cache by generating and storing cached versions of web pages without waiting for user requests. Users can set the update interval by determining how frequently a new set of cached pages is generated.

You can limit the number of pages created per batch based on server capabilities. Users can also specify a Sitemap URL to guide the primed cache creation, with pages cached according to XML file priorities.

Cache Preload

4: Purge Policy

This option allows users to specify the pages and feeds to purge when new posts are published, edited, or when comments are submitted to posts on your site. The Purge limit setting allows users to control the number of pages purged on post updates.

Purge Policy

5: Rest API

This option allows you to turn on/off, utilizing the WordPress API to enhance performance and scalability. Turning off the WordPress REST API provides an extra layer of security for users who may not require this functionality.

Enabling caching is recommended, especially when using WordPress as a backend for integrations. It significantly improves response times and reduces resource consumption for repeat API requests, which is particularly beneficial for scaling performance.

WordPress Rest API

6: Expert Advanced

  • Late initialization: With this option turned on, the caching engine postpones the initialization of specific caching processes until later in the page generation cycle. This delay allows for improved compatibility with WordPress functionality, especially when fragment caching is involved. It allows for more effective caching of dynamic elements, enhancing the overall performance and responsiveness of the website.
  • Late caching: This option introduces a mechanism to modify the caching process by postponing the extraction of entries during WordPress’s initialization (‘init’) action. This allows for the overwriting of the key used in the page caching process. This key is a unique identifier associated with a specific page or content, and it is crucial for retrieving the correct cached version. Website admins and developers can leverage this option to tailor the caching strategy based on precise requirements, providing elevated customization and flexibility.
  • Compatibility mode: This setting is designed to enhance the plugin’s interoperability with different hosting environments and address specific actions within the WordPress ecosystem. An example use case for enabling Compatibility Mode addresses issues related to Apache web server rules that sometimes conflict with caching mechanisms.
  • Charset: This option specifically addresses character encoding issues related to UTF-8 support. UTF-8 support correctly handles diverse characters, languages, and symbols on a website. This option might be relevant in situations where the default UTF-8 encoding leads to rendering problems or misinterpretation of characters and provides a means to experiment with alternative character encoding settings to find a configuration that resolves rendering issues.
  • Reject HEAD requests: This option handles HEAD HTTP requests and the associated caching behavior. HEAD is one of the HTTP methods browsers use to request only the headers of a particular resource (e.g., a web page) without requesting the full content. HEAD requests are used to gather information about a resource, such as its size or modification date, without downloading all of the content for performance reasons. Turning on this option ensures that requests made using the HEAD method do not result in the caching of full-page content. This option controls caching behavior and prevents scenarios where subsequent requests for a resource might return empty or incomplete pages.
  • Garbage collection interval: This option controls the frequency at which expired cache data is identified as expired or no longer valid and removed. Lower values are preferable for busy websites with high traffic and frequent content updates. Lower intervals ensure that expired cache data is removed more frequently. High-traffic sites with dynamic content or frequent updates benefit from shorter intervals. In contrast, lower-traffic sites with less dynamic content may not require as frequent garbage collection.
  • Comment cookie lifetime: This option refers to the duration for which comment cookies are deemed valid. Comment cookies are data stored on a user’s machine when they leave a comment on a website. Cookies help recognize the user when they revisit the site. TTL (Time to Live) refers to the duration for which a cookie remains valid. By setting a shorter TTL, the goal is to minimize the duration for which comment cookies are stored on users’ devices where there is a desire to reduce the volume of authenticated user traffic, lowering server load and improving overall server performance.
  • Accepted query strings: This option allows administrators to specify a list of URL parameters that must be cached. The query string is the part that comes after the “?” character and consists of key-value pairs separated by “&” symbols. Query strings are used to pass information to a web page, such as parameters for filtering, sorting, or customizing dynamic. By configuring accepted query strings, administrators have the flexibility to customize the caching behavior for URLs with distinct parameters. Everyday use cases include scenarios where specific parameters dynamically alter the content of a page, such as search results, filter options, or pages with sorting preferences.
  • Rejected user agents: This option allows administrators to specify a list of user agents for which cached pages should not be served. A User Agent is a string of text a browser sends to a web server to identify itself. They provide information about the browser, the browser version, and the device’s operating system that helps adjust content or styles based on the end user’s browser.
  • Rejected cookies: This option allows administrators to specify a list of cookies for which cached pages should not be served and dynamically generates content for each request for users with these defined cookies.
  • Never cache the following pages: This option allows you to define regular expressions for specific pages or directories to be excluded from caching. A regular expression (regex or regexp) is a pattern used to match character combinations in strings. This can be used when certain pages or directories contain dynamic content that should not be cached and typically includes pages with real-time data, user-specific content, or frequently changing information. It is essential to balance caching for performance benefits and serving dynamic content when necessary for specific pages or directories.
  • Never cache pages associated with these categories: This option lets you specify slugs (permalinks) associated with WordPress categories. WordPress content organization uses categories and tags, and each post or page can be related to specific authors or custom fields. You can build a list of slugs (for categories and tags) or usernames (for authors and custom fields) so as not to have cached versions served.
  • Never cache pages that use these tags: This option lets you specify slugs (permalinks) associated with WordPress tags. WordPress content organization uses categories and tags, and each post or page can be associated with specific authors or custom fields. You can build a list of slugs (for categories and tags) or usernames (for authors and custom fields) so as not to have cached versions served.
  • Never cache pages by these authors: This option lets you specify slugs (permalinks) associated with WordPress authors. WordPress content organization uses categories and tags, and each post or page can be associated with specific authors or custom fields. You can build a list of slugs (for categories and tags) or usernames (for authors and custom fields) so as not to have cached versions served.
  • Never cache pages that use these custom fields: This option lets you specify slugs (permalinks) associated with WordPress custom fields. WordPress content organization uses categories and tags, and each post or page can be associated with specific authors or custom fields. You can build a list of slugs (for categories and tags) or usernames (for authors and custom fields) so as not to have cached versions served.
  • Cache exception list: This option lets you override the general rule of not caching certain pages or directories specified in the Never Cache the Following Pages field, and using regular expressions is supported. This is useful when content must be cached, even if it matches exclusion patterns defined for other website areas.
  • Non-trailing slash pages: This option allows you to specify a list of regular expressions for pages without a trailing slash at the end of the URLs that must be cached. Web servers typically treat URLs with or without a trailing slash differently.
  • Specify page headers: This option allows you to extend the caching mechanism beyond the default by including specific HTTP headers and the cached page content. HTTP headers provide essential metadata about the content; for example, specifying Last-Modified can assist in more efficient browser caching and conditional requests.
    • Last-Modified: Indicates the last modification date of the resource.
    • Content-Type: Specifies the media type of the resource.
    • X-Pingback: Indicates the URL where a pingback to the resource should be sent.
    • P3P: Defines a platform for asserting the privacy practices of a website.
    • Link: Specifies relationships between the resource and other resources.
    Each header should be specified on a separate line.
  • Handle XML mime type: This option lets you control how the caching system handles the Content-Type header for XML files, specifying the media type of the resource being served, crucial for proper interpretation by browsers and user agents. This is relevant for websites that include XML files for feeds or sitemaps.

Minify

Minification in web development involves removing unnecessary characters from source code without changing its functionality. This process includes stripping out spaces, line breaks, comments, and block delimiters, which reduces the file size and improves web page load times. Minification optimizes the code to be more efficient for delivery and faster execution on web browsers. This process is commonly applied to CSS, HTML, and JavaScript files, contributing significantly to better performance and faster page rendering.

Minified CSS
An example of minified CSS

Additionally, smaller file sizes mean less bandwidth usage, which can be particularly beneficial for users on slower connections or mobile data. By optimizing a website’s performance, minification also contributes positively to search engine rankings, as search engines favor faster websites.

Basic Settings

The W3 Total Cache Minify option is designed to improve website performance by reducing the size of your website’s CSS, JavaScript (JS), and HTML files. This process can significantly improve web page load times by reducing the amount of data that needs to be downloaded by the user’s browser.

Here, you enable the minify option, select the minify mode, and select the minify cache method depending on whether you use a shared server, dedicated/virtual server, or multiple servers, and the HTML, JS, and CSS minify engine.

Minify Basic Settings

Advanced Settings

1: General

The Rewrite URL Structure option controls how the URLs for CSS and JavaScript (JS) files are structured when embedded in your web pages. When turned on, this setting uses a sophisticated and user-friendly URL structure. However, when turned off, the plugin uses GET variables instead.

The Disable Minify for Logged-in Users option lets you control whether minification should be applied to pages for users logged into the WordPress site. You can also turn on minification error notifications directly to the website Admin and via email.

General Minify Settings

2: HTML & XML

The HTML Minify Settings are intended to reduce the size of HTML files by removing unnecessary characters, whitespace, and comments, ultimately leading to faster page load times.

The Ignored Comment Stems option allows you to selectively preserve specified comments in the HTML, CSS, or JavaScript files during the minification. This option will not remove comments configured by Google Adwords and screen readers by default. In addition, you can add comments to the HTML to remain visible on a new line.

HTML & XML Settings

3: JS

The JS Minify Settings are designed to optimize the loading speed of JavaScript (JS) files on your WordPress website, resulting in faster page load times.

Minify JS Settings

The JS Minify Method option lets you choose how the JavaScript (JS) files should be minified. The minify method you select will impact the organization and delivery of your JS files.

  • Combine & Minify – This method combines multiple JS files into a single file and then minifies the combined file, reducing its overall size and enhancing performance.
  • Minify Only – This method minifies individual JS files without combining them, allowing for more granular control over the optimization process.
  • Combine Only – This method combines multiple JS files into a single file without minifying the combined file, preserving the original formatting and comments in the code. Combining the files reduces the number of HTTP requests made by the browser.

The Minify Engine Settings options are intended to embed minified JavaScript (JS) files within the HTML document. This option controls where the minified JS files should be placed in the HTML—either before the closing tag or after the opening tag. Additionally, it allows you to specify how the scripts are embedded, influencing their loading behavior. The choice of embed type can impact how fast your page loads and renders, depending on the requirements of the scripts.

  • Preserved comment removal (not applied when combine only is active)
  • Line break removal (not safe, not applied when combine only is active)

The HTTP/2 Push option will improve your website’s performance by proactively sending specific resources to the browser before the browser requests them. The primary goal is to expedite the loading of JavaScript files. This is particularly beneficial for critical resources needed for the initial rendering of a page.

4: CSS

The CSS Minify Settings optimizes the loading speed of CSS (Cascading Style Sheets) files by removing unnecessary characters, such as whitespace, comments, and line breaks, leading to faster page load times.

CSS Minify Settings

The CSS Minify Method option lets you choose how the CSS files should be minified without altering the functionality of the styles. The options are:

  • Combine & Minify – This method combines multiple CSS files into a single file and then minifies the combined file, reducing its overall size and enhancing performance.
  • Minify Only – This method minifies individual CSS files without combining them, allowing for more granular control over the optimization process.
  • Combine Only – This method combines multiple CSS files into a single file without minifying the combined file, preserving the original formatting and comments in the code. Combining the files reduces the number of HTTP requests made by the browser.

The Minify Engine Settings control how the minification process is applied to your HTML, CSS, and JavaScript files and is crucial in optimizing the loading speed of your WordPress website.

  • Preserved comment removal (not applied when combine only is active)
  • Line break removal (not applied when combine only is active)

The @import Handling option determines how the code manages imported CSS files using the @import rule in your stylesheets. The @import rule allows you to include external CSS files within a primary CSS file.

The HTTP/2 Push option leverages the capabilities of the HTTP/2 protocol to optimize the delivery of resources on your website by sending specific files to the browser before the browser requests them and reducing latency. HTTP/2 is a modern protocol that improves the efficiency of data transfer between the server and the browser.

5: Expert Advanced

  • Update external files every: This option allows you to specify the interval between downloading and updating external files in the minify cache. This applies to external JavaScript (JS) and CSS files included or referenced in your website but hosted on external servers or Content Delivery Networks (CDNs), contributing to optimal performance and functionality.
  • Garbage collection interval: This option controls the frequency at which expired cache data is identified as expired or no longer valid and removed. Lower values are preferable for busy websites with high traffic and frequent content updates. Lower intervals ensure that expired cache data is removed more frequently. High-traffic sites with dynamic content or frequent updates benefit from shorter intervals. In contrast, lower-traffic sites with less dynamic content may not require as frequent garbage collection.
  • Never minify the following pages: This option lets you specify specific pages that must not be minified.
  • Never minify the following JS files: This option lets you specify specific JavaScript (JS) files that must not be minified. Some JS files may contain code that is sensitive to minification methods.
  • Never minify the following CSS files: This option lets you specify certain Cascading Style Sheets (CSS) files that must not be minified. Some CSS files may contain code that is sensitive to minification methods.
  • Rejected user agents: This option allows administrators to specify a list of user agents for which cached pages should not be served. A User Agent is a string of text a browser sends to a web server to identify itself. They provide information about the browser, the browser version, and the device’s operating system that helps adjust content or styles based on the end user’s browser. 
  • Include external files/libraries: This option allows you to specify external files or libraries that can be combined for optimization, where multiple files are merged into a single file to reduce the number of HTTP requests and improve page loading times overall.
  • Use Regular Expressions for file name matching: This option allows you to use Regular Expressions (regex) when the names of external script files vary and require a more flexible and pattern-based approach to match multiple files with similar characteristics.

Opcode Cache

Opcode cache is a powerful W3TC feature that enhances the performance of a WordPress website by caching compiled PHP code. The use of Opcode in the PHP execution process facilitates a more efficient and scalable approach to script execution, reduces server load, improves response times, and ultimately enhances the overall speed and responsiveness of your WordPress site.

Opcode Cache

By storing pre-compiled code in memory, Opcode cache eliminates the need for repetitive interpretation and compilation of PHP files.

Database Cache

WordPress Database Caching, or Object Caching, is a method used to improve website performance by storing the results of database queries in the cache to reduce latency and increase throughput for read-heavy applications like WordPress. When a web page is requested, WordPress queries its database to retrieve the data, which can be time-consuming, mainly when complex queries or high traffic are used.

Database caching helps reduce the load on the database by saving the results of these queries. When the same data is requested again, it can be fetched from the cache instead of the database, leading to faster page load times and reduced server load. W3 Total Cache’s installation guidelines indicate that enabling this option on shared hosting setups may actually be counterproductive. We suggest testing your setup in isolation to judge its effectiveness.

The types of performance gains on offer will depend on the complexities of your setup. The main distinction is whether the information is stored on disk or in memory with a solution such as APC or Memcached. The common consensus is that in-memory solutions provide the best results for the database cache.

Basic Settings

This option is turned on by default, mimicking the default WordPress behavior. It excludes logged-in users from the cache, and user activity requests bypass the database cache. Logged-in users might change information, such as post authors publishing updates on a post or a site member updating their profile.

Database Cache Basic Settings

Advanced Settings

In the context of software or online platforms like WordPress plugins, Expert Advanced Settings refer to configurable options intended for users with advanced knowledge or specific technical expertise. These settings allow for granular control over the W3TC plugin functions, allowing you to fine-tune performance, security, and behavior better than basic settings. You can manipulate caching behaviors, database interactions, and fine-tuning performance metrics, among other technical aspects.

1: Expert Advanced

  • Maximum lifetime of cache objects: This option allows you to determine how long cached data must remain stored in memory before being considered outdated. A longer lifetime (in seconds) improves performance by serving cached content faster, reducing database queries and server load. For high-traffic websites with frequent changes to content, a shorter lifetime is recommended. A longer lifetime (in seconds) could suffice for low traffic with less frequent changes to content.
  • Garbage collection interval: This option controls the frequency at which expired cache data is identified as expired or no longer valid and removed. Lower values are preferable for busy websites with high traffic and frequent content updates. Lower intervals ensure that expired cache data is removed more frequently. High-traffic sites with dynamic content or frequent updates benefit from shorter intervals. In contrast, lower-traffic sites with less dynamic content may not require as frequent garbage collection.
  • Never cache the following pages: This option excludes specific pages or URLs from being stored in the database cache, allowing data to be retrieved directly from the database on every request. Dynamic pages with continually changing content, like user account information and shopping carts, should not be cached.
  • Ignored query stems: This option lets you specify exact sections of database queries that must not be cached. SQL queries containing these stems will always bypass the cache and retrieve data directly from the database, even if other parts of the query are eligible for caching.
  • Reject query words: This option lets you block caching based on specified words or patterns anywhere within a SQL query. Any query containing specific words, regardless of context or surrounding elements, will bypass the cache and retrieve data directly from the database. This is helpful when preventing caching of search results pages (for example) to guarantee users always see the latest results.
  • Reject constants: This option lets you prevent caching of any query containing specific constant values. The constant value could be a number, a string of text, or data included directly within a SQL query.

Object Cache

WordPress ships with several Object Caching options built-in for developers to access and use. Object Caching in the context of web performance, particularly with WordPress, refers to storing frequently accessed query results or computational data in memory to reduce the time required for these items to be computed or fetched from the database. This type of caching can significantly improve performance by decreasing the load on the database and speeding up the page-loading process, as the data is readily available in the cache rather than being recalculated or retrieved on each page request.

Basic Settings

Enabling Object Cache is particularly beneficial for websites with heavy database usage or high traffic volumes, as it helps alleviate the strain on the server by efficiently serving cached data.

Object Cache

Advanced Settings

These advanced settings allow for granular control over the W3TC plugin functions, allowing you to fine-tune cache performance and overall website behavior. You can manipulate caching and database interactions and refine cache performance metrics. 

1: Expert Advanced

  • Maximum lifetime of cache objects: This option sets the default timeframe in which cached objects remain stored in memory before being considered outdated. A longer lifetime (in seconds) improves performance by serving cached content faster, reducing database queries and server load. For high-traffic websites with frequent changes to content, a shorter lifetime is recommended. A longer lifetime (in seconds) could suffice for low traffic with less frequent changes to content.
  • Garbage collection interval: This option controls the frequency at which expired cache data is identified as expired or no longer valid and removed. Lower values are preferable for busy websites with high traffic and frequent content updates. Lower intervals ensure that expired cache data is removed more frequently. High-traffic sites with dynamic content or frequent updates benefit from shorter intervals. In contrast, lower-traffic sites with less dynamic content may not require as frequent garbage collection.
  • Global groups: This option controls what object groups should be cached in a WordPress multisite network. Caching these groups reduces redundant database queries. The default values are users, userlogins, usermeta, and user_meta. Since user data often changes infrequently, caching boosts performance without compromising data accuracy.
    In a WordPress multisite network, an “object group” refers to a collection of cached objects associated with a specific site or sub-site within the network. Object caching stores computationally expensive data like database query results in memory for faster retrieval. Each sub-site in a multisite setup can have its own object groups, enabling efficient and isolated caching. This separation ensures that cached data is organized and retrieved appropriately, improving performance for each sub-site in the network. Key aspects are:
    • Isolation: Data cached by one site remains isolated from others.
    • Performance Optimization: Frequently accessed data like database query results are cached for faster retrieval.
    • Scalability: Supports the scaling of large networks by optimizing cache for individual sub-sites.
  • Non-persistent groups: This option defines a list of object prefixes that will be excluded from object caching.
  • Enable caching for wp-admin requests: This option controls whether object caching applies to requests made from the WordPress admin area.
  • Store transients in database: Transients are temporary data pieces stored in the database for short periods, usually used by plugins or WordPress to cache specific values. If you use an external cache system (such as Redis or Memcached) alongside W3 Total Cache, the standard would be to store transients in that external cache alongside other object cache data. With this setting disabled, when you purge the object cache, the cached transients in the external cache are also purged, even though they might still be valid. Enabling this setting prevents that issue by forcing all transients to be stored in the database to maintain their intended lifespan.

Browser Cache

Browser cache is a storage mechanism in web browsers that saves copies of web resources (HTML files, images, CSS, and JavaScript). When a user revisits a website, the browser retrieves these cached files instead of downloading them again, significantly reducing page load times and server requests.

This results in a faster user experience and reduced bandwidth consumption, especially for static resources that don’t change frequently. Cached files have an expiration time to ensure users see up-to-date content.

Basic Settings

This W3TC plugin option turns on browser caching and will instruct visitors’ web browsers to store static files (HTML files, images, CSS, and JavaScript) from your WordPress website locally on their computer or mobile device. This results in faster page loading times and a smoother browsing experience for your visitors, ultimately improving your website’s overall speed and performance.

Browser Cache Basic Settings

Advanced Settings

These advanced options allow for granular control over the W3TC plugin functions, allowing you to fine-tune cache performance and overall website behavior.

1: General

The Set Last-Modified header option lets you decide whether or not your server must include a unique Last-Modified timestamp about the last time the content was changed when delivering web content.

The Set Expires Header option allows the plugin to instruct browsers and proxies to hold a cached version of the web content before rechecking the server. Instead of relying on the Last-Modified timestamp, an expiration date is set for each resource.

The Set Cache-Control Header option allows you to control the server’s caching directives and web content responses. This option instructs the server to include a Cache-Control header in its responses, specifying directives that govern how the content should be cached, stored, and re-validated by browsers and proxies.

The Set Entity Tag (ETag) option determines whether the server includes a unique ETag in its responses when delivering web content. When this option is activated, the server appends an ETag to its responses, serving as a mechanism for identifying changes in content. Web browsers and proxies leverage the ETag information to determine whether their cached version of the content is still valid or if they need to retrieve a fresh copy.

The Set W3 Total Cache header option sets an optional HTTP X-Powered-By header that websites can include in responses to assist in identifying requests and files optimized by the W3 Total Cache plugin. Some caching systems and CDNs might use the X-Powered-By header as part of their cache validation process. They might check for changes in the header’s value to determine if a cached resource version is still valid or needs to be refreshed. If the header changes, it could signal a change in the underlying software, potentially affecting cached content.

The Enable HTTP (gzip) compression option notifies the web server to compress HTML, CSS, and JavaScript files before sending them to the user’s browser. Gzip compression is crucial in enhancing both caching and website performance, reducing the file size by up to 70% and resulting in significantly smaller data transfers.

The Enable HTTP (Brotli) compression option (developed by Google) offers even more impressive compression capabilities than gzip compression. JavaScript files compressed with Brotli are roughly 15% smaller, HTML files are around 20% smaller, and CSS files are around 16% smaller. While Brotli compression is more powerful than gzip, the Brotli compression process is slower, making gzip preferable if you host a large amount of dynamic content that cannot be cached. SiteGround hosting has an instructive comparison between Brotli and Gzip compression.

The Prevent caching of objects after settings change option ensures that changes to your caching settings take immediate effect. When this option is turned on, any time you adjust your caching setup, a new query string is generated and added to your website’s objects. This new query string signals servers and browsers that the content has been modified, prompting them to fetch the updated version rather than relying on cached copies. When this feature is enabled, an Update media query string button will appear on your Browser Cache settings page to reset the query string.

The Remove query strings from static resources option will improve website performance and caching efficiency by removing query strings from static resources like images, CSS, and JavaScript files.

Example: website.com/image.jpg?v=123 website.com/image.jpg.

Browsers and proxy servers consider URLs with query strings as unique resources, even if the content is identical. This can lead to unnecessary re-downloads, slowing down page loads.

The Prevent caching exception list option provides granular control over caching behavior by allowing you to specify URLs or URL patterns that the cache mechanism should bypass. It safeguards and ensures that certain sensitive or dynamic content is always served fresh from the server. When a visitor requests a URL matching an entry on the exception list, the server will handle the request directly, generating a fresh response each time. Common use cases:

  • Sensitive Data: To protect user privacy and security, prevent URLs containing personal information, login pages, shopping carts, or other sensitive content from being cached.
  • Dynamic Content: Exclude URLs that display frequently changing content (e.g., live feeds, real-time
    dashboards, chat widgets) to ensure users always see the latest information.
  • Custom Functionality: Bypass caching for URLs that rely on specific user interactions or browser states to function correctly, preventing caching-related issues.
  • Troubleshooting: Temporarily add URLs to the list for testing or troubleshooting purposes.

The Don’t set cookies for static files option lets you optimize website performance and reduce unnecessary data transfers by preventing cookies from being attached to static files like images, CSS, and JavaScript. Additionally, browsers and CDNs can cache static files more effectively without considering cookie-based variations, reducing server load and enhancing performance.

The Do not process 404 errors for static objects with WordPress option bypasses WordPress for 404 errors related to static objects, allowing the server to handle them directly. Server-level 404 handling is often faster than WordPress-level processing, leading to speedier error responses and improving the overall user experience.

The 404 error exception option allows you to specify URLs or URL patterns that should not trigger a 404 error message, even if those resources don’t exist on your website. When a visitor requests a URL that matches an entry in the exception list, the server won’t generate a standard 404 error page, preventing errors for non-existent files and resources.

The Rewrite URL structure of objects option dynamically alters protected file URLs by appending unique query strings or identifiers, ensuring that each URL is distinct to the browser, even if the underlying file remains the same.

2: CSS & JS

The Set Last-Modified header option lets you decide whether or not your server must include a unique Last-Modified timestamp about the last time the content was changed when delivering web content.

When the Set Expires header option is turned on, the browser requests a CSS or JS file from the server, establishing an expiration date based on the defined lifetime. The browser stores the file in its cache and reuses it for subsequent visits to the same website or pages. Upon expiration, the browser requests a fresh copy of the file from the server.

The Expires header lifetime option instructs web browsers to cache CSS and JS files for a defined amount of time. You can specify a duration for the cache lifetime measured in seconds.

The Set Cache-Control header option instructs the webserver to include a Cache-Control header in its responses. It establishes directives that control how CSS and JS resources must be cached, stored, and revalidated by browsers and proxies. The global option offers a broad approach, while this option provides granular control for these crucial performance-affecting resources.

Using both settings is common, with the global setting defining a base framework and the CSS/JS setting tailoring behavior for specific file types.

The Cache-Control policy option provides different pre-defined configurations, simplifying the process of applying appropriate caching strategies for your JS and CSS files. Below are pre-defined policy examples:

  • Default: It sets a max-age=31536000 | public directive caching files for one year and allows sharing in public caches. It is suitable for static files that rarely change.
  • Aggresive: It sets a max-age=7200 | public directive and caches files for 2 hours. It aims for faster updates at the expense of a higher server load.
  • Lomg Expiry: It sets a max-age=2592000000 | public directive and caches files for 30 years, making it ideal for rarely updated files on low-traffic websites.
  • No Cache: Uses a no-cache | no-store | must-revalidate directive, forcing browsers to always revalidate with the server before using the file. Best for dynamically changing files where freshness is paramount.

The Set entity tag (eTag) option instructs the server to append an ETag to its responses to identify changes in CSS and JS files, significantly improving performance by reducing requests and file sizes. When files remain unchanged, browsers reuse cached versions based on matching ETags, which is particularly beneficial for static elements like layout styles and core JS libraries.

When a browser requests a resource that was previously requested, it sends the current ETag in the request header. The server compares the received ETag with the current resource’s ETag, and if they match, the server sends a 304 Not Modified response, informing the browser that the cached version is still valid.

The Set W3 Total Cache header option sets an optional HTTP X-Powered-By header that websites can include in responses to assist in identifying requests and files optimized by the W3 Total Cache plugin. Some caching systems and CDNs might use the X-Powered-By header as part of their cache validation process.

The Enable HTTP (gzip) compression option notifies the web server to compress HTML, CSS, and JavaScript files before sending them to the user’s browser. Gzip compression is crucial in enhancing both caching and website performance, reducing the file size by up to 70% and resulting in significantly smaller data transfers.

The Enable HTTP (Brotli) compression option (developed by Google) offers even more impressive compression capabilities than gzip compression. JavaScript files compressed with Brotli are roughly 15% smaller, HTML files are around 20% smaller, and CSS files are around 16% smaller. While Brotli compression is more powerful than gzip, the Brotli compression process is slower, making gzip preferable if you host a large amount of dynamic content that cannot be cached. SiteGround hosting has an instructive comparison between Brotli and Gzip compression.

The Prevent caching of objects after settings change option ensures that changes to your caching settings take immediate effect. When this option is turned on, any time you adjust your caching setup, a new query string is generated and added to your website’s objects. This new query string signals servers and browsers that the content has been modified, prompting them to fetch the updated version rather than relying on cached copies. When this feature is enabled, an Update media query string button will appear on your Browser Cache settings page to reset the query string.

The Remove query strings from static resources option will improve website performance and caching efficiency by removing query strings from static resources like images, CSS, and JavaScript files.

Example: website.com/image.jpg?v=123 website.com/image.jpg.

Browsers and proxy servers consider URLs with query strings as unique resources, even if the content is identical. This can lead to unnecessary re-downloads, slowing down page loads.

The Disable cookies for static files option optimizes website performance. It reduces unnecessary data transfers by preventing cookies from being attached to static files like images, CSS, and JS files. Each request that doesn’t carry cookies means less data is sent between the browser and server, leading to faster page loads and less bandwidth usage. Additionally, browsers and CDNs can cache static files more effectively without considering cookie-based variations

3: HTML & XML

The Set Last-Modified header option lets you decide whether or not your server must include a unique Last-Modified timestamp about the last time the content was changed when delivering web content.

The Set Expires Header option allows the plugin to instruct browsers and proxies to hold a cached version of the web content before rechecking the server. Instead of relying on the Last-Modified timestamp, an expiration date is set for each resource.

The Expires header lifetime option instructs web browsers to cache HTML and XML files for a defined amount of time. You can specify a duration for the cache lifetime measured in seconds.

The Set Cache-Control header option instructs the webserver to include a Cache-Control header in its responses. It establishes directives that control how HTML and XML resources must be cached, stored, and revalidated by browsers and proxies. The global option offers a broad approach, while this option provides granular control for these crucial performance-affecting resources.

The Cache-Control policy option provides different pre-defined configurations, simplifying the process of applying appropriate caching strategies for your HTML and XML files.

The Set Entity Tag (ETag) option determines whether the server includes a unique ETag in its responses when delivering web content. When this option is activated, the server appends an ETag to its responses, serving as a mechanism for identifying changes in content. Web browsers and proxies leverage the ETag information to determine whether their cached version of the content is still valid or if they need to retrieve a fresh copy.

The Set W3 Total Cache header option sets an optional HTTP X-Powered-By header that websites can include in responses to assist in identifying requests and files optimized by the W3 Total Cache plugin. Some caching systems and CDNs might use the X-Powered-By header as part of their cache validation process. They might check for changes in the header’s value to determine if a cached resource version is still valid or needs to be refreshed. If the header changes, it could signal a change in the underlying software, potentially affecting cached content.

The Enable HTTP (gzip) compression option notifies the web server to compress HTML, CSS, and JavaScript files before sending them to the user’s browser. Gzip compression is crucial in enhancing both caching and website performance, reducing the file size by up to 70% and resulting in significantly smaller data transfers.

The Enable HTTP (Brotli) compression option (developed by Google) offers even more impressive compression capabilities than gzip compression. JavaScript files compressed with Brotli are roughly 15% smaller, HTML files are around 20% smaller, and CSS files are around 16% smaller. While Brotli compression is more powerful than gzip, the Brotli compression process is slower, making gzip preferable if you host a large amount of dynamic content that cannot be cached. SiteGround hosting has an instructive comparison between Brotli and Gzip compression.

4: Media & Other Files

The Set Last-Modified header option lets you decide whether or not your server must include a unique Last-Modified timestamp about the last time the content was changed when delivering web content.

The Set Expires Header option allows the plugin to instruct browsers and proxies to hold a cached version of the web content before rechecking the server. Instead of relying on the Last-Modified timestamp, an expiration date is set for each resource.

The Expires header lifetime option instructs web browsers to cache media files for a defined amount of time. You can specify a duration for the cache lifetime measured in seconds.

The Set Cache-Control header option instructs the webserver to include a Cache-Control header in its responses. It establishes directives that control how media resources must be cached, stored, and revalidated by browsers and proxies. The global option offers a broad approach, while this option provides granular control for these crucial performance-affecting resources.

The Cache-Control policy option provides different pre-defined configurations, simplifying the process of applying appropriate caching strategies for your media files.

The Set Entity Tag (ETag) option determines whether the server includes a unique ETag in its responses when delivering web content. When this option is activated, the server appends an ETag to its responses, serving as a mechanism for identifying changes in content. Web browsers and proxies leverage the ETag information to determine whether their cached version of the content is still valid or if they need to retrieve a fresh copy.

The Set W3 Total Cache header option sets an optional HTTP X-Powered-By header that websites can include in responses to assist in identifying requests and files optimized by the W3 Total Cache plugin. Some caching systems and CDNs might use the X-Powered-By header as part of their cache validation process. They might check for changes in the header’s value to determine if a cached resource version is still valid or needs to be refreshed. If the header changes, it could signal a change in the underlying software, potentially affecting cached content.

The Enable HTTP (gzip) compression option notifies the web server to compress HTML, CSS, and JavaScript files before sending them to the user’s browser. Gzip compression is crucial in enhancing both caching and website performance, reducing the file size by up to 70% and resulting in significantly smaller data transfers.

The Enable HTTP (Brotli) compression option (developed by Google) offers even more impressive compression capabilities than gzip compression. JavaScript files compressed with Brotli are roughly 15% smaller, HTML files are around 20% smaller, and CSS files are around 16% smaller. While Brotli compression is more powerful than gzip, the Brotli compression process is slower, making gzip preferable if you host a large amount of dynamic content that cannot be cached. SiteGround hosting has an instructive comparison between Brotli and Gzip compression.

The Prevent caching of objects after settings change option ensures that changes to your caching settings take immediate effect. When this option is turned on, any time you adjust your caching setup, a new query string is generated and added to your website’s objects. This new query string signals servers and browsers that the content has been modified, prompting them to fetch the updated version rather than relying on cached copies. When this feature is enabled, an Update media query string button will appear on your Browser Cache settings page to reset the query string.

The Remove query strings from static resources option will improve website performance and caching efficiency by removing query strings from static resources like images, CSS, and JavaScript files.

The Disable cookies for static files option optimizes website performance. It reduces unnecessary data transfers by preventing cookies from being attached to static files like images, CSS, and JS files. Each request that doesn’t carry cookies means less data is sent between the browser and server, leading to faster page loads and less bandwidth usage. Additionally, browsers and CDNs can cache static files more effectively without considering cookie-based variations.

5: Security Headers

Security headers are HTTP headers that add an extra layer of security to web applications by controlling how browsers handle the site’s resources. They protect against common web vulnerabilities such as cross-site scripting (XSS), clickjacking, and content sniffing. The vast array of options in the W3 Total Cache plugin offers granular control.

Key Security Headers:
  • Content Security Policy (CSP): Prevents XSS by specifying allowed content sources.
  • Strict-Transport-Security (HSTS): Enforces HTTPS-only communication.
  • X-Frame-Options: Prevents clickjacking by controlling iframe embedding.
  • X-Content-Type-Options: Blocks MIME-type sniffing.
  • Referrer-Policy: Manages referrer data sent with requests.
Security Headers Quick Reference:

All directives that end with—src support similar values, known as a source list. Multiple source list values can be space-separated, with the exception of ‘none,’ which should be the only value.

  • * img-src * Wildcard, allows any URL except data: blob: filesystem: schemes
  • ‘none’ object-src ‘none’ Prevents loading resources from any source
  • ‘self’ script-src ‘self’ Allows loading resources from the same origin (same scheme, host and port)
  • data: img-src ‘self’ data: Allows loading resources via the data scheme (e.g. Base64 encoded images)
  • domain.example.com img-src domain.example.com Allows loading resources via the data scheme (e.g. Base64 encoded images)
  • *.example.com img-src *.example.com Allows loading resources from any subdomain under example.com
  • https://cdn.com img-src https://cdn.com Allows loading resources only over HTTPS, matching the given domain
  • https: img-src https: Allows loading resources only over HTTPS on any domain
  • ‘unsafe-inline’ script-src ‘unsafe-inline’ Allows the use of inline source elements such as style attribute, onclick, or script tag bodies (depends on the context of the source it is applied to)
  • ‘unsafe-eval’ script-src ‘unsafe-eval’ Allows unsafe dynamic code evaluation such as Javascript eval()

Cache Groups

In the W3 Total Cache plugin, cache groups refer to different categories of data that can be cached separately. They help isolate and organize cached content for efficient retrieval and management.

1: Manage User Agent Groups

This option allows you to create a group of User Agents for tablets and mobile phones. Assign a set of User Agents to use a specific theme, redirect them to another domain, or create User Agent Groups if an existing mobile plugin is active to create a unique cache for each.

2: Manage Referrer Groups

This option allows you to create a group of Referrers. Assign a set of Referrers to use a specific theme, redirect them to another domain, and create Referrer groups to ensure a unique cache for each group.

3: Manage Cookie Groups

This option allows you to create a group of Cookies. Assign a set of Cookies to create a unique cache for each Cookie Group.

Options here will naturally vary from provider to provider but the good folks over at WPBeginner have an excellent breakdown of how to install MaxCDN with W3 Total Cache that should give you a good idea of the overall process.

The default Advanced settings should work out of the box on most setups, so begin there before starting to tweak.

W3TC Resources And Showcase

Many blue-chip companies trust the W3 Total Cache plugin for their websites. Along with Frederick Townes’ work for Mashable, high-profile sites such as yoast.com, ilovetypography.com, smashingmagazine.com, and Matt Cutts have all plumped for this plugin as their caching solution in the past.

Resources

As you explore W3 Total Cache further, it’s worth bookmarking a few references for general information and troubleshooting purposes:

  • W3 Total Cache plugin homepage: The Installation and FAQ tabs here address many common issues users run into. Make sure you review them both carefully. You can also access the support forums from this page.

  • W3 Edge FAQ: This set of FAQs provides a little more detail, including coverage of technical questions such as, for example, whether to choose opcode caching or memcached. It’s well worth a detailed read before you start integrating on your own site.
  • Stack Exchange: As always, Stack Exchange and Stack Overflow are likely to be your friend at some stage.

Showcase

The following links provide some more detailed breakdowns of real-world W3 Total Cache performance that you might find useful when digging deeper into how best to implement it on your own site:

  • MyBloggingThing: A good overview of how W3 Total Cache can fit into an overall optimization strategy.

  • DashboardJunkie: An excellent deep-dive comparison of real-world W3 Total Cache performance as measured against other popular caching solutions.

Summary

We hope the points above will shed further light on some of the more advanced features of W3 Total Cache and help you make the most of it within the parameters of your own particular setup. Two takeaways:

  • If you’re managing your own servers – virtual or dedicated – database and object caching both stand to bring major performance increases.

  • Minification and using a Content Delivery Network are options available to all and should bring significant gains to both you and your users.

Subscribe To Our Newsletter

Receive all of the latest news and updates fresh from ThemeFusion!

Leave a comment