Have you noticed how fast this page loads? Well, its because I have enabled best possible W3 Total Cache plugin settings along with Cloudflare free CDN. Wondering how? I am about to reveal the secret in this post, keep reading.
W3 total cache is one of the best caching tools for a WordPress site. However, it is more than just a caching mechanism, if we use the right settings for it. In this post, I will explain how we can speed up your WordPress and Woocommerce site using W3 total cache plugin without spending a single penny.
Using W3 total cache, you can speed up your WordPress site five times than usual. Just download the plugin or go to “Plugins” – “Add New” and search “W3 total cache” and install the plugin. It will only take 5 minutes to apply these settings.
If you are using VPS or cloud server, I will recommend you to install Memcached on your web-server to improve your caching performance. Here are the links to some helpful articles to install Memcached on your web server.
Or you can ask your web hosting company to install Memcached on your server.
First of all, we will enable the general settings of W3 total cache, and after that, we will enable the advanced settings. Here are the best general settings of W3 total cache to boost your website speed.
Table of Contents
1. Enable Page Cache
Page cache is significant to transfer files faster. Page cache builds a cache of your pages in your storage disk and moves them more quickly without using your hosting RAM power.
Its time enable the Advanced Settings for Page Cache
1 (a). Apply these general settings
- Enable cache front page
- Enable cache feeds
- Enable cache SSL (https) requests
- Enable cache URIs with query string variables
- Enable cache 404 (not found) pages
- Enable don’t cache pages for logged in users
1 (b). Leave the Aliases settings disabled
1 (c). Apply these cache preload settings
Make sure to change the sitemap URL of your WordPress blog.
1 (d). Apply these Purge policy settings
1 (e). Apply these Rest API settings
We don’t have to cache the Rest API for some obvious reasons.
1 (f). Apply these advanced settings
You can only enable the Memcached hostname and persistent connection settings if you have a Memcached installed on your web server. Otherwise, just leave it.
2. Enable Minify
Minification reduces the spacing and duplicate codes from your HTML, CSS and Javascript files to lessen their size by 10%. That is why minification is so important, and even Google recommends it.
- Enable minify
- Select minify mode as Auto
- Set minify cache method as disk
- Leave HTML, JS, CSS minifier as default
Furthermore, apply these Advance Settings for Minify
2 (a). Apply these General minify settings
Please note that “Structure rewrite” only works when your web server is properly configured with the W3 total cache. Otherwise, it will break your WordPress CSS and JS. You can check the compatibility of your web server from the “Dashboard of W3 total cache”.
If you are using the Nginx web server, you need to integrate it with your W3 total cache. Include the Nginx.conf file, created by W3 total cache on your public folder, to your Nginx Server setting. Read here to know more.
If it is not working for you, just untick Rewrite URL Structure.
2 (b). Apply these XML and HTML settings
Enable the inline minification to line up all your CSS and JS in your HTML file to reduce loading time.
2 (c). Apply these Javascript minification settings
- Make sure to enable non-blocking using “defer” before </head> and after <body>
- Also tick, preserved comment removal and line break removal
- Enable HTTP/2 push
These settings are responsible for improving the “first visual impression” of your WordPress page by using the “Defer” method by creating non-blocking JS above the folder.
2 (d). Apply these CSS minification settings
- Enable CSS Minify and make it combined only
- Also, enable HTTP/2 push
These settings will combine all your CSS files into one file to reduce network lookup time and make your CSS file lighter by reducing its size.
2 (e). Apply these Advance Minify settings
Applicable only for those, who have enabled the Memcached extension.
Furthermore, make sure to add all the external files like Google fonts, Analytic codes in your Minify settings.
3. Enable Opcode Cache
The opcode is an enhancement extension of PHP. Opcache cache builds a cache of PHP code compilation into bytecode. Finally, your web server will not compile PHP code every time. Instead, it will use a copy of the opcode cache to minimize the parsing and compiling time of PHP files.
4. Enable Database Cache
Whenever a user requests a post, page or comment, all the information is pulled from your database. If these requests increase, your database may get crash. So we also need a database cache to save a cache of the database file on the disk to serve the information quickly without triggering the central Database.
4 (a). Advance settings for database cache
Leave the original settings as it is. You don’t need to change anything.
5. Disable Object Cache
You don’t need to activate the object cache as it can make your backend slow. So just leave it as it is.
6. Enable Browser Cache
Do you know that your browser also saves temporary files from a website such as CSS, JS, HTML, images as well as other multimedia files? Well, you can encourage the browser cache using W3 total cache to enable HTTP compression and add headers to reduce server load and decrease file load time.
6 (a). Advance settings for browser cache
Simply enable the settings as shown in the above image
- Set expires header
- Set cache control header
- Set entity tag
- Set W3 total cache header
- Enable HTTP (gzip) connection
- Prevent caching of an object after settings change
- Remove query string
- Don’t set cookies for static files
Finally, click Save settings and Purge cache button.
W3 Total Cache Result
Using the above settings, your WordPress site is now up to 5 times faster than usual. You can test your site speed on Pingdom. Also, read this post to speed up your WordPress site using free image CDN and other methods.
Integration with Cloudflare
You can use Cloudflare to host the cache of your WordPress web pages from different locations. This will improve latency time for your visitors and as a result, your page will load faster than before. You can read how you can use the best Cloudflare setting for WordPress to improve its performance.
Also, if you are a serious blogger, you might need a reliable web hosting for your online success. Here I have listed some of the fastest web hosting that you should definitely try.