Exclude Homepage from Cache

User
exclude hompe page from cache wordpress
Assistant
To **exclude the homepage from cache** in WordPress, the approach depends on the caching system or plugin you're using. Here's how to do it with popular caching plugins:

### ✅ **1. WP Super Cache**
Go to:
**Settings > WP Super Cache > Advanced**
Scroll to **“Accepted Filenames & Rejected URIs”** and in the “Rejected URIs” box, add:

/

This will exclude the homepage (root URL) from being cached.

### ✅ **2. W3 Total Cache**
Go to:
**Performance > Page Cache > Advanced**

In **“Never cache the following pages”**, add:

index.php
/

Save the settings and purge cache.

### ✅ **3. WP Rocket**
WP Rocket doesn’t offer direct settings in the dashboard for excluding the homepage. But you can exclude it via code:

Add the following to your theme’s `functions.php`:

add_filter( 'rocket_cache_reject_uri', function( $urls ) {
    $urls[] = '/';
    return $urls;
});

Then clear WP Rocket’s cache.

### ✅ **4. LiteSpeed Cache**
Go to:
**LiteSpeed Cache > Cache > Excludes**

In **Do Not Cache URIs**, add:

/

Save settings and purge cache.

### ✅ **5. Cloudflare (if caching at edge)**
– Create a **Page Rule**:
`http://yourdomain.com/` (or `https://` depending on your SSL)
Set: **Cache Level: Bypass**

If you’re using a custom or server-level cache (like **Nginx FastCGI**, **Varnish**, or **Redis Object Cache**), let me know and I can guide you on excluding the homepage from those specifically.

Would you like help with any specific caching plugin you're using right now?

Leave a Comment

Your email address will not be published. Required fields are marked *