Directory-based cache layout + mod_rewrite static serving #11

Open
opened 2026-09-13 11:50:32 +00:00 by kevin.bataille · 0 comments
Owner

The fastest cache hit is one that never executes PHP. Modern caching plugins serve static files directly via web-server rules (Apache mod_rewrite in wp-content/cache/.htaccess, nginx try_files) and use the advanced-cache.php drop-in only as fallback.

WP Recache stores flat md5(host+path).html files — opaque hashes make rewrite-rule serving impossible, so every hit costs a PHP process.

Spec:

  • Cache layout becomes cache/wp-recache/{host}{uri}/index(-mobile).html
  • Activation writes mod_rewrite rules serving those files when present (with logged-in-cookie and query-string conditions); nginx documented via try_files snippet
  • Human-inspectable paths; purge-by-URL = delete one directory
  • Drop-in remains as fallback for non-Apache servers

Note: supersedes the md5 layout introduced in the Phase 1 collision fix; both solve collisions, but only the directory layout enables static serving.

The fastest cache hit is one that never executes PHP. Modern caching plugins serve static files directly via web-server rules (Apache mod_rewrite in wp-content/cache/.htaccess, nginx try_files) and use the advanced-cache.php drop-in only as fallback. WP Recache stores flat md5(host+path).html files — opaque hashes make rewrite-rule serving impossible, so every hit costs a PHP process. **Spec:** - Cache layout becomes cache/wp-recache/{host}{uri}/index(-mobile).html - Activation writes mod_rewrite rules serving those files when present (with logged-in-cookie and query-string conditions); nginx documented via try_files snippet - Human-inspectable paths; purge-by-URL = delete one directory - Drop-in remains as fallback for non-Apache servers **Note:** supersedes the md5 layout introduced in the Phase 1 collision fix; both solve collisions, but only the directory layout enables static serving.
kevin.bataille added the phase-1 label 2026-09-13 11:50:32 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kevin.bataille/wp-recache#11