You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-12Lines changed: 13 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ Modern and simple full page cache plugin for WordPress inspired by [Cachify](htt
7
7
8
8
BC Cache has no settings page - it is intended for webmasters who are familiar with `.htaccess` files and WordPress actions and filters.
9
9
10
+
BC Cache can cache not only HTML pages, but [core XML sitemaps](https://make.wordpress.org/core/2020/07/22/new-xml-sitemaps-functionality-in-wordpress-5-5/) as well. Technically, any content type generated by WordPress for front-end requests routed via root `index.php` file can be handled provided that output generation triggers [`template_redirect`](https://developer.wordpress.org/reference/hooks/template_redirect/) hook.
11
+
10
12
## Requirements
11
13
12
14
* Apache webserver with [mod_rewrite](https://httpd.apache.org/docs/current/mod/mod_rewrite.html) enabled
@@ -17,8 +19,7 @@ BC Cache has no settings page - it is intended for webmasters who are familiar w
17
19
18
20
* BC Cache has not been tested on WordPress multisite installation.
19
21
* BC Cache has not been tested on Windows servers.
20
-
* BC Cache can only serve requests without filename in path, ie. `/some/path` or `some/other/path/`, but not `/some/path/to/filename.html`.
21
-
* BC Cache does not support [content negotation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation#the_accept_header). If contents of URL are deemed cacheable, content is always returned as `text/html` regardless of `Accept` header send by client.
22
+
* BC Cache does not support [content negotation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation) via `Accept` header.
# Main rules: serve only GET requests with whitelisted query string fields coming from anonymous users.
@@ -143,6 +142,8 @@ If there was a settings page, following filters would likely become plugin setti
143
142
144
143
*`bc-cache/filter:can-user-flush-cache` - filters whether current user can clear the cache. By default, any user with `manage_options` capability can clear the cache.
145
144
*`bc-cache/filter:html-signature` - filters HTML signature appended to HTML files stored in cache. You can use this filter to get rid of the signature: `add_filter('bc-cache/filter:html-signature', '__return_empty_string');`
145
+
*`bc-cache/filter:cached-response-headers` - filters HTTP response headers generated by WordPress/PHP that are kept when cache entry is created. These headers are then sent as additional response headers with cached content. By default following headers are kept: `Content-Type`, `Link`, `X-Robots-Tag`, `X-BC-Cache-Generated`. Note that `Content-Type` header is crucial for proper delivery of cached content and thus is always preserved.
146
+
*`bc-cache/filter:cache-generation-timestamp-format` - filters format of cache generation timestamp. This timestamp is included in HTML signature and in `X-BC-Cache-Generated` HTTP response header. The value must be a valid `$format` argument for [`wp_date()`](https://developer.wordpress.org/reference/functions/wp_date/).
146
147
147
148
#### Filters for advanced functions
148
149
@@ -285,7 +286,7 @@ This way cached pages can be served to front-end users too. Cookie name and cont
285
286
286
287
## Request variants
287
288
288
-
Sometimes a different HTML is served as response to request to the same URL, typically when particular cookie is set or request is made by particular browser/bot. In such cases, BC Cache allows to define request variants and cache/serve different HTML responses based on configured conditions. A typical example is the situation in which privacy policy notice is displayed until site visitor accepts it. The state (cookie policy accepted or not) is often determined based on presence of particular cookie. Using request variants, BC Cache can serve visitors regardless if they have or have not accepted the cookie policy.
289
+
Sometimes a different response body is served to request to the same URL, typically when particular cookie is set or request is made by particular browser/bot. In such cases, BC Cache allows to define request variants and cache/serve different response body based on configured conditions. A typical example is the situation in which privacy policy notice is displayed until site visitor accepts it. The state (cookie policy accepted or not) is often determined based on presence of particular cookie. Using request variants, BC Cache can serve visitors regardless if they have or have not accepted the cookie policy.
289
290
290
291
### Request variant configuration example
291
292
@@ -312,7 +313,7 @@ The [default configuration](#installation) needs to be extended as well and set
Important: Variant names are appended to basename part of cache file names, so `index.html` becomes `index_cna.html` and `index.html.gz` becomes `index_cna.html.gz` in the example above. To make sure your setup will work, use only letters from `[a-z0-9_-]` range as variant names.
316
+
Important: Variant names are appended to basename part of cache file names, so `index` becomes `index_cna` and `index.gz` becomes `index_cna.gz` in the example above. To make sure your setup will work, use only letters from `[a-z0-9_-]` range as variant names.
0 commit comments