How to Configure WP Rocket Plugin for WordPress
WP Rocket is a popular WordPress plugin designed to optimize your website's performance and speed. This guide will walk you through the simple steps to configure WP Rocket for optimal performance.
Step 1: Install and Activate WP Rocket
Purchase and Download:
First, you need to purchase WP Rocket from their official website. After purchasing, download the plugin file to your computer.
2. Download the Plugin:
After purchasing, download the WP Rocket zip file to your computer.
Step 2: Log in to WordPress Admin
Access WordPress Admin Area:
Open your browser and navigate to your WordPress login page (usually yourwebsite.com/wp-admin).
Enter your username and password to log in.
Step 3: Remove W3 Total Cache
Deactivate and Delete W3 Total Cache:
Go to Plugins > Installed Plugins in your WordPress dashboard.
Find W3 Total Cache, click Deactivate, and then click Delete.
Remove any other optimization plugins to prevent conflicts with WP Rocket.
Step 4: Install WP Rocket
Upload WP Rocket Plugin:
In your WordPress dashboard, go to Plugins > Add New.
Click on the Upload Plugin button at the top.
Install the Plugin:
Click Choose File, select the downloaded WP Rocket zip file, and click Install Now.
Activate the Plugin:
Once installed, click Activate Plugin.
License activation happens automatically, so there's no need to enter an API key.
Step 5: Configuring WP Rocket
Default Settings:
Upon activation, WP Rocket automatically enables page caching, browser caching, GZIP compression, and other performance enhancements. These rules are added to your .htaccess file.
Varnish Cache Purge:
If Varnish is enabled on your server (default on WeWP), go to the Varnish tab in WP Rocket and check Enable the Varnish caching auto-purge.
Purge OPCache:
WeWP provides OPCache, and you'll see a Purge OPCache link in the WP Rocket admin toolbar if you need to clear it.
Purge Varnish When Using a Proxy:
When using a proxy service like Cloudflare, clearing the Varnish cache might not work effectively. Use the following steps to fix this:
Creating a Custom File:
Create a folder named mu-plugins in your wp-content directory if it doesn't already exist.
Create a new file using a basic text editor and add the following code:
<?php
defined( 'ABSPATH' ) or die( 'Cheatin’ uh?' );
/**
* Plugin Name: Fix Varnish Auto Purge with Proxy and WP Rocket
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
add_filter( 'rocket_varnish_purge_request_host', '__rocket_varnish_custom_hostname' );
function __rocket_varnish_custom_hostname() {
return 'example.com';
}
add_filter( 'rocket_varnish_ip', '__rocket_varnish_custom_ip' );
function __rocket_varnish_custom_ip() {
return 'localhost';
}
Replace example.com with your domain name.
Save the file as wp-rocket-varnish-purge-proxy.php.
Upload this file to the mu-plugins folder.
Re-activate WP Rocket:
Deactivate and reactivate WP Rocket, and manually clear the cache of your proxy if necessary.
Verify Varnish Cache Clearing:
Open Developer Tools in Chrome (Ctrl+Shift+I or Menu > More Tools > Developer Tools).
Click the Network tab and reload your website.
Check the Age header value. After purging, it should reset to 0.
Step 6: LazyLoad and Minification
Enable Features One-by-One:
In WP Rocket settings, enable LazyLoad and minification options one-by-one.
Check your site in a logged-out window to ensure there are no display issues.
Consult Documentation if Issues Arise:
For any problems with LazyLoad or minification, refer to the WP Rocket documentation:
LazyLoad Documentation
Minification Documentation
Disabling Problematic Options:
If issues persist, disable the option and clear the cache to revert your site back to normal.
Conclusion
Configuring WP Rocket on your WordPress site is a straightforward process that can significantly enhance your site's speed and performance. By following the steps outlined in this guide, you will:
Download and Install WP Rocket efficiently.
Remove Conflicting Plugins like W3 Total Cache to ensure WP Rocket runs smoothly.
Activate and Automatically Apply essential caching and performance optimizations.
Configure Varnish Cache settings for better integration with proxies like Cloudflare.
Enable and Test LazyLoad and Minification settings to further optimize your site's load times without causing display issues.
Add URL Exclusions to ensure smooth operation of WP Rocket’s minification process alongside Varnish.
By taking these steps, you will ensure that your WordPress site runs faster, providing a better experience for your visitors. Regularly monitor your site’s performance and make adjustments as necessary to maintain optimal speed and efficiency. With WP Rocket, you are equipped with powerful tools to keep your site running smoothly and quickly.
Last updated