Skip to main content

Cache Exclusions & Advanced Rules

Advanced Rules provide granular control over which pages/content get cached and which assets get optimized.

Cache Exclusion Rules​

Cache exclusions prevent specific URLs from being cached.

When to Use Exclusions​

Exclude pages that:

  • Require dynamic content per user (login pages, account dashboards)
  • Show different content based on cookies/sessions
  • Have time-sensitive information
  • Should always be fresh (support pages, pricing)

Common Exclusion Patterns​

/wp-admin/*
/wp-login.php
/wp-cron.php
/my-account/*
/cart/*
/checkout/*
/?p=
/?s=*
/reset-password*
/confirm-email*

Adding Exclusions​

  1. Go to Performance Toolkit → Advanced Rules (if available) or Cache settings
  2. Find Cache Excluded URLs section
  3. Add one URL pattern per line
  4. Use wildcards (*) for flexible matching
  5. Click Save changes

Exclusion Rule Syntax​

Exact Match​

/special-page/

Excludes only /special-page/ exactly.

Wildcard Pattern​

/blog/*/comments

Excludes /blog/article-1/comments, /blog/article-2/comments, etc.

Full Directory​

/my-account/*

Excludes all URLs under /my-account/: /my-account/, /my-account/settings/, etc.

Query String Match​

/?s=*

Excludes search results (URLs with ?s=query).

Asset Minification Exclusions​

Prevent specific CSS/JS files from being minified or combined.

CSS Exclusions​

Go to File Optimization → Minify external CSS files → Exclusions

Examples:

bootstrap
critical.css
/wp-content/plugins/woocommerce/*

JavaScript Exclusions​

Go to File Optimization → Minify external JS files → Exclusions

Examples:

jquery-core
analytics.js
/wp-content/themes/my-theme/js/critical.js

Why Exclude Specific Assets?​

  • Plugin conflicts — minified CSS breaks styling
  • Conditional loading — script shouldn't be combined
  • Critical rendering path — inline critical CSS/JS separately
  • Third-party — external ads/analytics with their own delivery

Combining Cache Exclusions​

Exclude Multiple URL Patterns​

Enter multiple patterns in the exclusion textarea:

/wp-admin/*
/wp-login.php
/wp-json/*
/my-account/*
/cart/*
/checkout/*
/?s=*
/password-reset*
/add-to-cart*

Line breaks between entries.

Testing Exclusions​

After adding exclusion:

  1. Clear cache — go to Tools, clear all cache
  2. Visit excluded URL — should display correctly
  3. Visit non-excluded URL — should be cached
  4. Check console — look for JavaScript errors
  5. Test interactions — ensure functionality works

Advanced Rule Examples​

E-Commerce Site (WooCommerce)​

# Never cache
/wp-admin/*
/wp-login.php
/?s=*
/my-account/*
/cart/*
/checkout/*
/?add-to-cart=*
/?remove_item=*
/?post_type=product

Blog with Members Plugin​

# Public pages cache
/

# Never cache
/wp-admin/*
/wp-login.php
/members/*
/profile/*
/?s=*
/?paged=*

Agency/Services Site​

# Cache most pages
/

# But not these
/wp-admin/*
/wp-login.php
/contact-form*
/?s=*
/thank-you*
/callback*

Asset Exclusion Examples​

CSS Exclusions​

# WooCommerce styles (may break if minified)
woocommerce-general
woocommerce-layout

# Critical CSS (already optimized)
critical.css
inline-critical

# Theme-specific
/wp-content/themes/*/css/critical.css

JavaScript Exclusions​

# jQuery (often required early)
jquery-core
jquery-migrate

# Analytics (has own minification)
google-analytics
gtag

# Form plugins
/wp-content/plugins/gravity-forms/*
/wp-content/plugins/cf7/*

Troubleshooting Exclusions​

Exclusion not working​

  1. Check syntax — did you type the URL correctly?
  2. Check wildcards — * expands correctly?
  3. Leading slashes — most patterns start with /
  4. Clear cache — changes don't apply to old cache
  5. Save changes — did you click Save?

Too many exclusions defeating caching​

If you have 20+ exclusion rules:

  1. Review which are truly necessary
  2. Only exclude user-specific or dynamic pages
  3. Cache more aggressively and fix issues with specifics
  4. Test thoroughly before expanding exclusions

Site broken after exclusions saved​

  1. Clear cache and do hard refresh (Ctrl+Shift+R)
  2. Check browser console for JavaScript errors
  3. Remove the last exclusion added and test
  4. Add back one at a time to find culprit

Performance Impact​

Proper exclusion rules:

  • Maintain cache hit rate — don't over-exclude
  • Keep pages fresh — exclude truly dynamic content
  • Prevent issues — exclude problematic pages/assets

Best Practices​

  • ✅ Exclude URLs with query parameters (?s=, ?paged=)
  • ✅ Exclude admin and login pages
  • ✅ Exclude user-specific pages (cart, account, profile)
  • ✅ Start with minimal exclusions; add as needed
  • ✅ Test before deploying to production
  • ✅ Document why each exclusion exists
  • ✅ Review quarterly; remove unnecessary exclusions
  • ❌ Don't over-exclude (defeats caching)
  • ❌ Don't exclude entire site (pointless)
  • ❌ Don't exclude low-traffic pages (not worth it)

Regular Configuration Review​

Quarterly:

  1. Review exclusion list
  2. Remove rules no longer needed
  3. Add new patterns for new features
  4. Test after any significant plugin/theme updates
  5. Monitor cache hit rate trends

Advanced: Custom Rules (if Available)​

Some configurations allow custom cache rules:

  • Cache this URL for 1 day (vs default TTL)
  • Don't cache this URL ever
  • Cache but bypass CDN
  • Cache and serve stale on origin error

Check Advanced Rules section for these options if available.

  • See Cache page for cache TTL and size settings
  • See File Optimization for asset-specific rules
  • See System Status for cache hit rate monitoring
  • See Troubleshooting section if having issues

Advanced rules put you in control of exactly what gets cached and optimized for your specific site's needs.