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

  1. 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

  1. Access WordPress Admin Area:

  • Open your browser and navigate to your WordPress login page (usually

  • Enter your username and password to log in.

Step 3: Remove W3 Total Cache

  1. 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

  1. Upload WP Rocket Plugin:

  • In your WordPress dashboard, go to Plugins > Add New.

  • Click on the Upload Plugin button at the top.

  1. Install the Plugin:

  • Click Choose File, select the downloaded WP Rocket zip file, and click Install Now.

  1. 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

  1. 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.

  1. 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.

  1. 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.

  1. 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:

  1. 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:


defined( 'ABSPATH' ) or die( 'Cheatin&#8217; uh?' );


* Plugin Name: Fix Varnish Auto Purge with Proxy and WP Rocket

* Author: WP Rocket Support Team

* Author URI:

* License: GNU General Public License v3 or later

* License URI:


add_filter( 'rocket_varnish_purge_request_host', '__rocket_varnish_custom_hostname' );

function __rocket_varnish_custom_hostname() {

return '';


add_filter( 'rocket_varnish_ip', '__rocket_varnish_custom_ip' );

function __rocket_varnish_custom_ip() {

return 'localhost';


  • Replace with your domain name.

  • Save the file as wp-rocket-varnish-purge-proxy.php.

  • Upload this file to the mu-plugins folder.

  1. Re-activate WP Rocket:

  • Deactivate and reactivate WP Rocket, and manually clear the cache of your proxy if necessary.

  1. 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

  1. 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.

  1. Consult Documentation if Issues Arise:

  • For any problems with LazyLoad or minification, refer to the WP Rocket documentation:

    • LazyLoad Documentation

    • Minification Documentation

  1. Disabling Problematic Options:

  • If issues persist, disable the option and clear the cache to revert your site back to normal.


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:

  1. Download and Install WP Rocket efficiently.

  2. Remove Conflicting Plugins like W3 Total Cache to ensure WP Rocket runs smoothly.

  3. Activate and Automatically Apply essential caching and performance optimizations.

  4. Configure Varnish Cache settings for better integration with proxies like Cloudflare.

  5. Enable and Test LazyLoad and Minification settings to further optimize your site's load times without causing display issues.

  6. 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