Powered Cache serves cached pages through PHP on every web server, without extra setup. On Apache and LiteSpeed it can also write rules to your .htaccess file, so the web server sends cached pages directly without starting PHP, and adds browser caching and compression. On Nginx, you add such rules to the server configuration yourself.
Available in: Powered Cache (free)
Where to find it: Powered Cache → Advanced → .htaccess Configuration
Requires: Apache or LiteSpeed for the automatic rules, and a writable .htaccess file in the WordPress root folder.

How cached pages are served #
| Server | Without server rules | With server rules |
|---|---|---|
| Apache, LiteSpeed | PHP sends the cached file (X-Powered-Cache: PHP). | The web server sends the cached file (X-Powered-By: Powered Cache). Written automatically by .htaccess Configuration. |
| Nginx | PHP sends the cached file (X-Powered-Cache: PHP). | Nginx sends the cached file (X-Powered-Cache: nginx). You add the rules by hand. |
Serving through PHP is already fast, because WordPress, plugins and the database are not loaded. Server rules make it a little faster again and save PHP workers on busy sites. See Check Cache Status to see which way a page was served.
.htaccess Configuration (Apache and LiteSpeed) #
Lets Powered Cache write recommended rules to the .htaccess file in your WordPress root folder. Default: on when WordPress detects Apache or LiteSpeed, off on other servers. Keep it on unless your host manages .htaccess for you.
The rules go into one block at the top of the file, between # BEGIN POWERED CACHE and # END POWERED CACHE. Powered Cache rewrites this block every time you save the settings or use Regenerate Configuration. Lines outside the block are not changed.
What the rules do #
- Serve cached pages directly. Apache sends the cached file when the request is not a
POST, has no query string, matches your permalink trailing slash, does not come from a rejected user agent or fromfacebookexternalhit, has no rejected cookie (including the WordPress login and comment cookies), and a cached file exists. HTTPS, Separate Mobile Cache and Gzip Compression are taken into account. - Browser caching (
mod_expires): browsers keep static files for a while instead of downloading them on every visit. HTML, XML and JSON are not kept. - Compression (
mod_deflate): HTML, CSS, JavaScript, JSON, XML, SVG and font files are compressed on the way out. - Headers for cached HTML files:
X-Powered-By: Powered CacheandCache-Control: public. ETag headers are removed. - CORS headers for images and fonts, when the CDN integration is on, so fonts load from your CDN hostname.
- The
/_static/rewrite, when File Optimizer Rewrite Rules is on.
| File type | Browser cache lifetime |
|---|---|
| CSS and JavaScript | 1 year |
| JPEG, PNG, GIF, WebP, BMP, TIFF and HEIC images | 6 months |
| SVG images and font files | 4 months |
| Favicon | 1 week |
| RSS and Atom feeds | 1 hour |
| HTML, plain text, XML and JSON | Not cached by the browser |
Long lifetimes for CSS and JavaScript are safe, because WordPress and Powered Cache add version strings to these URLs when the files change.
What the server rules do not check #
The web server checks fewer conditions than Powered Cache does in PHP:
- Rejected Referrers are not checked.
- When Mobile Cache is off, the rules do not detect mobile devices. Mobile visitors can still get the cached desktop page from the server.
- While Vary Cookies has any entry, including cookies added automatically for supported cookie consent plugins, Powered Cache leaves the direct-serving rules out. Browser caching and compression rules are still written. Cached pages are then served by PHP.
If you rely on one of the first two, turn .htaccess Configuration off and remove the Powered Cache block, as described below.
Turning the rules off #
- While .htaccess Configuration is on, the block is removed automatically when you turn off Page Cache or deactivate Powered Cache.
- Turning .htaccess Configuration off does not remove the block that is already in the file. Powered Cache simply stops updating it. To remove it, delete everything from
# BEGIN POWERED CACHEto# END POWERED CACHEin.htaccess, or turn off Page Cache and save while the option is still on.
Requirements and multisite #
- The
.htaccessfile must exist and be writable. Otherwise the settings screen warns: Automatic .htaccess configuration is enabled, but the .htaccess file could not be found or … is not writable. Save your permalinks once in Settings → Permalinks to create the file, or ask your host to fix its permissions. - On multisite, the network shares one
.htaccessfile. Powered Cache writes it only when the plugin is network-activated and a network administrator saves the settings. See Multisite Setup.
Changed in 4.0: Rejected User Agents in the
.htaccessrules now match anywhere in the user agent, the same way as in PHP. Before 4.0, the server rules could treat them differently.
LiteSpeed and OpenLiteSpeed #
WordPress treats LiteSpeed as an Apache-compatible server. Powered Cache therefore offers .htaccess Configuration there and writes the same rules. Powered Cache has no separate LiteSpeed integration.
- Do not run the LiteSpeed Cache plugin’s page cache at the same time. Two full-page caches make problems hard to trace, and the Optimization Advisor warns about it. See Other cache plugins.
- OpenLiteSpeed supports only part of the
.htaccesssyntax and may need a restart before it reads changes. If cached pages are not served directly there, Powered Cache still serves them through PHP. Ask your host if you are unsure.
Nginx #
Nginx does not read .htaccess files. Leave .htaccess Configuration off. The Optimization Advisor recommends this too.
Page caching works on Nginx without any change to the server configuration: cached pages are served through PHP. Most Nginx sites can stop here. Browser caching and compression for static files are usually set up by your host.
Powered Cache 4.1 does not show ready-made Nginx rules in its settings. If you manage your own server and want Nginx to send cached pages directly, add rules like the following to your site’s server block. They are based on the rules Powered Cache generates internally. Replace the try_files line of your existing location / block instead of adding a second one, and test on a staging site first.
# Powered Cache: serve cached pages directly
set $pc_cache_uri $request_uri;
set $pc_ssl "";
if ($request_method = POST) { set $pc_cache_uri 'null cache'; }
if ($query_string != "") { set $pc_cache_uri 'null cache'; }
if ($https = "on") { set $pc_ssl "-https"; }
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml)") {
set $pc_cache_uri 'null cache';
}
if ($http_cookie ~* "wordpress_[a-f0-9]+|wordpress_logged_in_|wp-postpass|comment_author_|powered_cache_commented_posts") {
set $pc_cache_uri 'null cache';
}
if ($http_user_agent ~* "facebookexternalhit") {
set $pc_cache_uri 'null cache';
}
location / {
add_header X-Powered-Cache nginx;
try_files /wp-content/cache/powered-cache/$http_host/$pc_cache_uri/index${pc_ssl}.html $uri $uri/ /index.php?$args;
}
- If you use a custom cache folder or WordPress lives in a subfolder, adjust the path after
try_files. - Add your own Rejected Cookies and Rejected User Agents to the matching lines.
- Do not use these rules together with Vary Cookies, Separate Mobile Cache, Rejected Referrers, or Mobile Cache turned off. Nginx cannot tell those visitors apart.
- With Gzip Compression on, Powered Cache saves only
.html.gzfiles, so these rules find no file and every request goes to PHP. Leave Gzip Compression off and let Nginx compress responses.
Reload Nginx and check a logged-out page for X-Powered-Cache: nginx. If you use File Optimizer Rewrite Rules, add the /_static/ rule from that page as well. To keep logged-in user cache files private, see Protect Cache Directory.
Troubleshooting #
The site shows a server error after saving #
Some hosts do not allow every directive in .htaccess. Connect with FTP or your host’s file manager, open .htaccess in the WordPress root folder, and delete the block from # BEGIN POWERED CACHE to # END POWERED CACHE. Then turn off .htaccess Configuration and save. Your pages are still cached and served through PHP.
Pages are never served directly by Apache #
- Check that the Powered Cache block exists in
.htaccessand that the server hasmod_rewrite. - Check that Vary Cookies is empty and no cookie consent plugin from the supported list is active.
- Test without a query string and while logged out.
For developers #
powered_cache_auto_htaccess_update: returnfalseto stop Powered Cache from writing.htaccess.powered_cache_mod_rewrite: returnfalseto leave out the rules that serve cached pages directly.powered_cache_browser_cache,powered_cache_browser_cache_lifespan,powered_cache_browser_cache_assets_lifespanandpowered_cache_browser_cache_default_lifespan: turn off or change the browser cache rules.powered_cache_htaccess_add_cors,powered_cache_htaccess_cache_control_rules,powered_cache_pre_htaccessandpowered_cache_after_htaccess: change the CORS and Cache-Control rules, or add your own rules before or inside the block.
Save the settings after adding a filter so the block is written again. See the hook reference.