How to Optimize WordPress With W3 Total Cache and GTmetrix

Optimize WordPress With W3 Total Cache and GTmetrix

As your site gets traffic and clients or users, and as you start include extra content, then your WordPress website may start to slow down because of the fact that WordPress needs to recompile each page each time a client access to it.

By using caching, you can decrease the measure of work WordPress needs to accomplish for each page load, which will then optimize WordPress website.

Since WordPress does not have built in caching functionality, one can utilize the W3 Total Cache module to add it to WordPress. To measure the improvement in speed, you can utilize the GTmetrix module. Let’s start with installing the GTmetrix plugin.

Installing the GTmetrix Plugin

Here, first install the GTmetrix plugin to help test the speed of the WordPress website. For doing this follow the below given steps:

  1. Log in to your WordPress as the Admin.
  2. From the left menu, hover over Plugins, and then click Add New.
  3. In the search box, type GTmetrix, and then click Search.
  4. Under the listing GTmetrix for WordPress, click Install Now.
  5. In the confirmation window, click OK to install the plugin.
  6. After the plugin has installed, click Activate Plugin.
  7. From the left menu, click GTmetrix.
  8. Open a new browser window, and navigate to this site http://gtmetrix.com/api/
  9. Click onGenerateAPI Key.
  10. If you already have a GTmetrix account, log in with your account. Otherwise, one can click on the Create an Account in the popup and enter your account details.
  11. After your account has been created, you may need to click Generate API Key again to generate the key.
  12. Copy the API key that you have generated, and switch back to the window with your WordPress administration page.
  13. If you are no longer on the GTmetrix configuration screen, from the left menu click GTmetrix.
  14. In the GTmetrix Account Email text box area, type the e-mail address associated with your GTmetrix account.
  15. In the API Key text box, paste the API Key you copied from the GTmetrix site.
  16. Then Click on Save Changes.

&nbsp

Running a Performance test using GTmetrix

GTmetrix helps one to determine the level optimization of your WordPress website. To run the performance test, read and follow the steps given below.

  1. Sign in to your WordPress as the administrator.
  2. From the left menu, hover over GTmetrix, and afterward click Tests.
  3. For testing your home page, click Test your Front Page Now.
  4. The test runs, and an evaluated score shows up.
  5. To see the nitty detailed results of the test, click Detailed report under the results of your test.

&nbsp

Installing and Configuring the W3 Total Cache Plugin

W3 Total Cache Plugin

This W3 total cache adds functionality to the WordPress to optimize WordPress website. now for installing the plugins follow these steps.

  1. Sign in to your WordPress account as the administrator.
  2. From the left menu, drift over the Plugins, and after that click on the Add New.
  3. In the search box, type W3 Total Cache, and afterward click on Search.
  4. Under the listing W3 Total Cache, click on Install Now.
  5. In the confirmation window, click on OK to install this plugin.
  6. After this plugin is installed, click on Activate Plugin.
  7. From the left menu, hover over Performance, and after that click on the General Settings.
  8. On the off chance that the error message “The required directives for fancy permalinks couldn’t be detected” shows up, follow these steps given below:
  • From the left menu, hover over the Settings, and after that click Permalinks.
  • Select a method for Permalinks other than the default setting, and after that click on Save Changes.
  • To come back to the W3 Total Cache Settings, hover over Performance in the left of the menu, and after that click General Settings.
  1. Under Page Cache, select the Enable check box.
  2. Under Minify, select the Enable check box.
  3. Under Database Cache, select the Enable check box.
  4. Under Object Cache, select the Enable check box.
  5. Under Browser Cache, select the Enable check box.
  6. And then click on the Save all settings.
  7. On the off chance if the error message “One or more plugins have been activated or deactivated, then please empty the page cache” shows up, chick empty the page
  8. Open the first page of the optimize WordPress website in a browser window, and refresh it a couple of times to confirm there are no errors. This permits the W3 Total Cache module to create the initial cache for your home page.
  9. As of now, you can run another test with GTmetrix to confirm the improved performance with the W3 Total Cache Plugin installed and enabled.

Related Post: The Best Ways to Optimize Images to Increase Site Speed

Adding Expires Directives to the .htaccess File

You should add Expires directives to the .htaccess file to completely permit browser-based caching.

Expires headers instruct the browser to utilize a locally cached copy of a file as instead to downloading it from the server once more, as long as the local copy has been obtained within a particular period of time. You can also change the expiration dates of the things in these directives anyway you need.

For adding Expires directives to your .htaccess file, follow the given steps:

  1. Open the FTP connection of your WordPress website.
  2. Then download the .htaccess file and then open it in a text editor.
  3. Then paste the following directives at the beginning of the file, ensure that they appear before any other derivative in the file.

 


## EXPIRES CACHING ##

ExpiresActive On

ExpiresByType image/jpg “access 1 year”

ExpiresByType image/jpeg “access 1 year”

ExpiresByType image/gif “access 1 year”

ExpiresByType image/png “access 1 year”

ExpiresByType application/pdf “access 1 month”

ExpiresByType application/x-shockwave-flash “access 1 month”

ExpiresByType image/x-icon “access 1 year”

ExpiresDefault “access 2 days”

## EXPIRES CACHING ##

 

  1. Save the .htaccess file, and then upload it to your optimize WordPress website, as overwriting the existing .htaccess file.
  2. Then open your WordPress site’s home page and the verify the modified .htaccess file does not any kind of error.
  3. You can now also run another test with the GTmetrix to verify the improved performance with the Expires directives enabled.

 

Hope the information was helpful and you learn how to optimize your WordPress website with W3 total cache and GTmetrix with all the steps given above.

Deepika Sharma

Writer and WordPress blogger at SKT Themes. Handling content partnerships, doing outreach, and making sure sktthemes.in is up to date.