Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Page Cache Exclusion

Security covered Under active development 584 sites

This module allows you to prevent specific pages or patterns of URLs from being cached by Drupal's internal page cache. This helps to keep your cache table clean, prevent database bloat, and improve overall performance by excluding unnecessary cache entries like 404 errors or dynamic content. You can configure exclusions using exact paths, wildcards, or regular expressions.

Smartly control what gets cached — and keep your Drupal database clean.

Page Cache Exclusion gives you fine-grained control over Drupal’s internal page cache system. Instead of letting every page (including 404 errors, unwanted URLs, or dynamically generated content) clutter your cache table and bloat your database (huge cache_page table in Drupal), this module lets you exclude specific paths or patterns from being cached.

What it does

  • ✅ Excludes specified paths from being cached by the internal page cache system.
  • 🧹 Prevents unnecessary cache entries (like 404 pages or bots hitting invalid URLs) from filling up your database.
  • 🧠 Helps improve overall performance and keeps your cache table lean and efficient.

Why use it?

Drupal’s default internal page cache (cache_page table in the database) can sometimes work too well — even caching pages that you don't want cached, like:

  • 404 pages
  • Spam or bot traffic
  • Dynamic or frequently changing content (Pages with exposed filters, views, ...)
  • Custom sections of your site where caching is problematic

This module lets you avoid unnecessary cache bloat and gives you more control over performance tuning, especially on high-traffic or complex sites.

Benefits

  • Cleaner and smaller cache tables
  • Better database performance over time
  • Easy configuration of path-based cache exclusion
  • Peace of mind for devs and site maintainers

How to use

1. Install the module

Via Composer:

composer require drupal/page_cache_exclusion

Then enable it:

drush en page_cache_exclusion

Or enable it from the Extend admin UI directly from the Drupal backoffice.

2. Configure Path Exclusions

Go to /admin/config/development/performance/page_cache_exclusion (also available via Configuration > Development > Page Cache Exclusion)
You’ll see a simple form where you can define one URL path per line. You can use:

  • a) Exact paths (/some/path)
  • b) Wildcards (/some/*/pattern)
  • c) Regular expressions (/^node\/[0-9]+/)

The first field "Exclude cache for page variation with query parameters" helps you exclude pages where query parameters are present, for example, the /search page of your website contains exposed filters that, when clicked, redirect to URLs like /search?filter1=xxx&filter2=ZZZ . To exclude all these generated URLs you cam simply add the line /search to this field. (NB: This doesn't exclue the page /search itself!)
The second field, "Paths to exclude", is used to exclude a whole page.
You can also check the field "Disable caching 4xx responses" to exclude caching of all pages with 4XX responses (usually robots or old pages)

3. Save and Test

Usage example

/mypage/xxx
/yyyypage/*
/search/*
/myform/
Drupal 9–11

Ask your assistant about Page Cache Exclusion

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • page_cache Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Sep 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
1.0.2 Stable 9–11 Feb 27, 2025
1.0.1 Stable 9–10 Sep 11, 2024
1.0.0 Stable 9–10 Sep 10, 2024