WordPress Cache Enabler Plugin

The WordPress Cache Enabler plugin is a lightweight caching plugin that creates static HTML files and stores them on your web server. This means that a static HTML file will be delivered whenever possible to provide users with the response data that would otherwise involve the resource intensive process of using the WP core, plugins, and database. This simple, yet powerful plugin is easy to use, needs minimal configuration and best of all helps improve site load time.

Installation

Installation of the WordPress Cache Enabler plugin is easily and can be done in just a few steps. Watch our installation video or follow the outlined steps below.

WordPress Cache Enabler Plugin Settings

Caching in WordPress is an important factor to improve the overall web performance of your website. This video shows you how to configure the WordPress Cache Enabler plugin.

  1. Navigate to the Plugins page in your WordPress Dashboard and select Add New.
  2. Search for “Cache Enabler – WordPress Caching” and select Install Now > Activate Plugin.
  3. The plugin is now installed and activated on your WordPress installation and you can navigate to the plugin’s settings by going to Settings > Cache Enablercache-enabler

Features

The WordPress Cache Enabler Plugin comes with the following features and customization options.

  • Fast disk cache engine
  • Manually clear cache from the admin bar or plugin settings page
  • Manually purge page-specific cache
  • Automated cache expiry
  • Option to enable automatic clearing of cache if a new comment is posted
  • Cache size displayed in your WordPress dashboard
  • Option to enable cache minification (HTML or HTML & inline JS)
  • WordPress multisite support
  • Custom Post Type support
  • Option to exclude caching of specific posts or pages by ID
  • Integration of WebP images
  • HTTP/2 focused
  • Works perfectly with Autoptimize
  • Supports responsive images via srcset in WordPress 4.4

The WordPress Cache Enabler also makes use of the If Modified Since header to help the browser determine whether the content has changed since the creation of the static cached file. If the content has not changed, the status code for the initial HTML document will be returned to the browser as 304. If the content has changed, the HTML document is fetched again, returning a status code of 200.wordpress-cache-304-not-modified

FAQ

How can I check if the cache enabler is working on my site?

You can quickly verify that the Cache Enabler is delivering a cached version of a specific page by logging out of your WordPress installation and checking the page source for either of these comments:

<!-- Cache Enabler by KeyCDN @ 10.11.2015 17:32:29 (webp gzip) -->
<!-- Cache Enabler by KeyCDN @ 10.11.2015 17:32:29 (webp) -->
<!-- Cache Enabler by KeyCDN @ 10.11.2015 17:32:29 (html gzip) -->
<!-- Cache Enabler by KeyCDN @ 10.11.2015 17:32:29 (html) -->

Upon activation, Cache Enabler performs 2 things:

  1. Adds define('WP_CACHE', true); // Added by Cache Enabler to your wp-config.php file
  2. Copies the advanced-cache.php file from the cache-enabler to the wp-content directory

The X-Cache-Handler: wp header is shown if the advanced-cache.php file is used. Otherwise, if WP_CACHE is set to false (e.g. define('WP_CACHE', false);) then Cache Enabler will not bypass PHP and you will see the following header X-Cache-Handler: php.

cache enabler x cache handler header

If upon activation Cache Enabler is unable to write to your wp-config.php file, then you will receive the following warning in your WordPress dashboard.

cache enabler warning

If you receive this warning, you can either change your file permissions and reinstall the plugin or manually add define('WP_CACHE', true); to your wp-config.php file. This will greatly help improve the performance of your website.

How can I convert my images to WebP?

To convert images to Webp, use the Cache Enabler plugin in conjunction with the Optimus Image Optimizer Plugin and enable the Webp options on both plugins.

How does the WebP integration work?

The WordPress Cache Enabler parses the jpeg and png images located in your upload directory to see if there is an equivalent WebP image (generated by Optimus). These WebP images are then included in the WebP cached html file.

Does Cache Enabler work with Disqus conditional load plugin?

Yes. In order to have Cache Enabler work properly with DCL plugin, simply navigate to DCL settings and set the Caching Support option to “Enable”. Save your settings and DCL will now work properly with Cache Enabler.

dcl settings

Does Cache Enabler work with mobile themes if the desktop and mobile versions are different?

It is not recommended to use the Cache Enabler plugin if a mobile theme or plugin is used that shows different layouts for desktop and mobile. The cache is bypassed if any of these plugins are used:

  • WPtouch
  • Carrington
  • Jetpack
  • Handheld

Otherwise the cached version is delivered to the mobile user.

Why isn’t my Woocommerce stock updating?

If you are experiencing an issue with Woocommerce stock being cached and therefore not updating, try updating to the latest version of Woocommerce. As of version 2.5.2 the issue is resolved and the stock number no longer conflicts with caching plugins.

What happens if a new post is published?

By default, only the home page cache is cleared when a new post is published. However, In the settings page of Cache Enabler you have the option to clear the complete cache when a new post is published.

cache-enabler-cache-behavior

How often is the cache updated?

There are a few options you can set that determine how often the cache is updated.

  1. You have the option to enable the clearing of complete cache every time someone posts a new comment. This can be done from the Cache Enabler settings page.
  2. You can clear the cache manually from the WordPress admin bar or by selecting the Save Changes button from the Cache Enabler settings page.cache-enabler-clear-cache
  3. You have the option to clear the complete cache or page specific cache each time a post is updated. This can be achieved directly from the post page.clear-cache-from-post
  4. The cache can also be cleared automatically in predetermined time intervals. This can be defined directly in the WordPress Cache Enabler’s settings page under the Cache Expiry option. Set how often the cache should be cleared (in hours). A Cache Expiry of 0 means the cache never expires automatically.

Can I clear the cache of a specific URL?

Yes. You can clear the cache of a specific URL directly from the WordPress admin bar by clicking “Clear URL Cache”.

cache enabler clear url cache

Does Cache Enabler work with default permalinks?

No. Cache Enabler does not work with default permalinks

Can I use Cache Enabler with the WordPress Nexus theme?

Yes. However, upon installing the WordPress Cache Enabler on a site using the Nexus theme, you must rebuild the permalinks. This can be done by going to your WordPress Dashboard > Settings > Permalinks and selecting Save Changes.

Will Cache Enabler’s expiry function still work if I’m using the advanced snippet?

No. Cache Enabler’s ability to automatically expire the cache based on a defined period will no longer work as the PHP calls required for that function will be bypassed.

wordpress cache enabler cache expiry

However, a cron job may be created in order to continue expiring the cache automatically. Add the following command to your cron job once you have determined the time period for which you would like the cache to expire */1 * * * * rm -rf /path/to/your/wordpress/wp-content/cache/cache-enabler/

How can I verify that the advanced snippet is bypassing PHP?

By adding the advanced configuration snippet to your Apache server you have the ability to bypass PHP in order to retrieve the static HTML file that was created by the WordPress Cache Enabler plugin. In order to ensure you are in fact bypassing PHP after you’ve added the snippet, open up your developer tools, navigate to Network and select the HTML file of your page.

If you’ve added the advanced snippet configuration below, upon checking the headers you will notice that no special WordPress Cache Enabler headers are added. If the X-Cache-Handler header is not present, then your advanced configuration snippet is properly implemented.

You can also check your response headers using a cURL command such as:

curl -D - http://wordpress.keycdn.net/ -o /dev/null
 % Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 200 OK
Server: nginx
Date: Tue, 17 May 2016 11:59:04 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.5.9-1ubuntu4.14

How do I find a page or post ID?

You can easily find your page or post IDs for adding to the cache exclusions list in the settings page. To find the ID, you can hover over a page or post title from the main list page and see the page or post idea at the bottom left of the page like so:

Page-ID-Hover

Alternatively, you may click into a specific page or post and the ID will appear in the url:

Page-ID-URL

How do I use Cache Enabler on a WordPress multisite setup?

Using the WordPress Cache Enabler plugin on a multisite setup is quite straightforward. Once the plugin is downloaded you have two options:

  1. You can activate Cache Enabler via network activation and it will start working for each site.
  2. You can enable Cache Enabler on each site individually if you don’t want it enabled across the entire network.

All the cache and settings are configured to work individually for each site. Therefore, you can clear the cache on site 1, while site 2 and 3 will retain their cache. If you need to access the cached files from the backend, they are located at /wp-content/cache/cache-enabler/yourdomain.com.

Advanced Configuration

A more advanced configuration can be implemented on the origin web server to bypass PHP entirely for even faster delivery. The following configuration snippets can be implemented on Apache or Nginx servers. The advanced configuration snippets should only be used by those who are experienced in modifying .htaccess files. Furthermore, the default Cache Enabler setup should satisfy the majority of use-cases.

This configuration is optional and is not necessary to implement in order to use the Cache Enabler plugin. It is only a suggested configuration for those who want to entirely bypass PHP if a static HTML file exists. The Expiry directive will be bypassed as well with the advanced configuration.

Apache

Add the following snippet before the # BEGIN WordPress section in your .htaccess file if you are using Apache 2.3.9 or later.

The snippet defines certain conditions and if they are met then the RewriteRule will be triggered. For the gzip version, the last condition, RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html.gz -f, checks to see if the HTML static file is available and if that condition, and all other conditions are met, a rewrite is triggered. The static HTML file is then directly fetched (preventing any PHP calls) and sent back to the client.

The SUB_PATH variable needs to be adjusted accordingly if you have installed WordPress in a sub directory (e.g. http://www.example.com/blog requires a change to
SUB_PATH=/blog/wp-content/cache/cache-enabler/).

Additionally, if you change the location of wp-admin, this must also be adjusted in the following condition RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*.

# BEGIN Cache Enabler
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# set blog sub path
SetEnvIf Request_URI "^(.*)$" SUB_PATH=/wp-content/cache/cache-enabler/

# set Cache Enabler path
SetEnvIf Request_URI "^(.*)$" CE_PATH=$1
SetEnvIf Request_URI "^(/)index.php$" CE_PATH=$1

<IfModule mod_mime.c>
# webp HTML file
RewriteCond %{ENV:CE_PATH} /$
RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTP:Accept} image/webp
RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html.gz -f
RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html.gz [L]

# gzip HTML file
RewriteCond %{ENV:CE_PATH} /$
RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html.gz -f
RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html.gz [L]

AddType text/html .gz
AddEncoding gzip .gz
</IfModule>

# webp HTML file
RewriteCond %{ENV:CE_PATH} /$
RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
RewriteCond %{HTTP:Accept} image/webp
RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html -f
RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html [L]

# default HTML file
RewriteCond %{ENV:CE_PATH} /$
RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html -f
RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html [L]

# wp override
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [END]
</IfModule>
# END Cache Enabler

We recommend to upgrade Apache whenever possible but you might need to use this snippet if you are using an older Apache release (< 2.3.9) or if you get an error with the example above:

# BEGIN Cache Enabler
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# set blog sub path
SetEnvIf Request_URI "^(.*)$" SUB_PATH=/wp-content/cache/cache-enabler/

# set Cache Enabler path
SetEnvIf Request_URI "^(.*)$" CE_PATH=$1

<IfModule mod_mime.c>
# webp HTML file
RewriteCond %{ENV:CE_PATH} /$
RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTP:Accept} image/webp
RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html.gz -f
RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html.gz [L]

# gzip HTML file
RewriteCond %{ENV:CE_PATH} /$
RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html.gz -f
RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html.gz [L]

AddType text/html .gz
AddEncoding gzip .gz
</IfModule>

# webp HTML file
RewriteCond %{ENV:CE_PATH} /$
RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
RewriteCond %{HTTP:Accept} image/webp
RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html -f
RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html [L]

# default HTML file
RewriteCond %{ENV:CE_PATH} /$
RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html -f
RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html [L]
</IfModule>
# END Cache Enabler

Nginx

We recommend to use the gzip_static on; directive to directly deliver the gzipped version of the static HTML file to the client. However, gzip_static is not required but you should have at least gzip enabled gzip on; for best performance.

The $custom_subdir variable needs to be adjusted accordingly if you have installed WordPress in a sub directory (e.g. http://www.example.com/blog).

server {

    set $cache_uri $request_uri;

    # bypass cache if POST requests or URLs with a query string
    if ($request_method = POST) {
        set $cache_uri 'nullcache';
    }
    if ($query_string != "") {
        set $cache_uri 'nullcache';
    }

    # bypass cache if URLs containing the following strings
    if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
        set $cache_uri 'nullcache';
    }

    # bypass cache if the cookies containing the following strings
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
        set $cache_uri 'nullcache';
    }

    # custom sub directory e.g. /blog
    set $custom_subdir '';

    # default html file
    set $cache_enabler_uri '${custom_subdir}/wp-content/cache/cache-enabler/${http_host}${cache_uri}index.html';

    # webp html file
    if ($http_accept ~* "image/webp") {
        set $cache_enabler_uri '${custom_subdir}/wp-content/cache/cache-enabler/${http_host}${cache_uri}index-webp.html';
    }

    location / {
        gzip_static on; # this directive is not required but recommended
        try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    }

    ...

}

Clearing Cache Via Third Party

The PHP snippet below can be used to clear the cache via a third party such as a Cron Job for example. The first section initializes the WordPress environment, normally this PHP file should be located in your WordPress root directory. The second if performs the action of completely clearing the cache and with the third if you have the ability to specify which post ID you would like to clear the cache for.

// initilize WordPress environment
if ( !defined('ABSPATH') ) {
	require_once('./wp-load.php');
}

if ( has_action('ce_clear_cache') ) {
    do_action('ce_clear_cache');
}

if ( has_action('ce_clear_post_cache') ) {
    do_action('ce_clear_post_cache', 1111); // post_id
}

127 Comments

  1. kingkool68

    Neat. I’ll certainly be checking this out. One thing I really want to do is serve the static cached HTML from a CDN such as KeyCDN. Does this plugin allow for that?

    1. Sven

      This caching plugin is a replacement for other caching plugins. Which means the “db cache” feature is not required.

  2. Nils

    Could you just let me know if I need to set upr a cronjob to check wp-cron since I added the above code to my htaccess and if no PHP is executed some functions might not work like scheduled posts?

    1. Cody

      The .htaccess rules merely bypass PHP in order to retrieve the cached static HTML files directly. No cronjob is necessary, it will not affect your PHP functions.

  3. Drake

    Hello,

    I’m a KeyCDN, Optimus Pro user and I’m now interested in your WP cache enabler plugins, since Im using WP Rocket on my site, can I use both plugins on my site or better go with one?

    Thank you a ton!

    1. Cody

      We recommend just going with one. The Cache Enabler plugin is meant to be a replacement for other caching plugins therefore you can disable any others.

  4. Dr. Ohad Hershkovitz

    i just tried switching from w3 total cache to cache enabler, but my website comes up blank after enabling and configuring the plugin. i get a “website is not available” error. i have tried disabling cache minification but that did not resolve the problem.

  5. niiu

    Cache Enabler is super fast!

    But I found if I use /%category%/%postname% in permalink, advanced configuration in NGINX won’t work. Then if I change to /%category%/%postname%/ with ending slash, it works fine.

    How should I adjust the configuration in NGINX to use permalink without ending slash?

  6. Jake

    After playing with the plugin and checking my logs, the only thing Cache Enabler seems to do out-of-box is minify. Even when the cache is shown in the page source, PHP is still dynamically generating every request. So while the request sent may be a bit smaller from the cache minification, there’s not much improvement when the server is under load from many visitors because each request is still being generated via PHP.

    I tried adding your .htaccess advanced configuration to bypass PHP, which didn’t do anything. I also tried the nginx conf, but that returned errors. After multiple emails to support about this over the past week that have all gone unanswered except for one unhelpful one, I’ve been disappointed in this plugin and KeyCDN’s service.

    I’m hoping the lack of response is because of end-of-year holidays. Otherwise, I’ll have to give this plugin a miss and move on.

  7. Steve

    Is it possible to disable caching for Firefox?

    For some reason the browser does not like this plugin and some of my sliders etc dont load correctly.

  8. Steve Wright

    I’ve narrowed down my Disqus problems (in that Disqus won’t load on posts) to Cache Enabler. Any ideas on how to fix? Has anyone else had the problem?

    1. Brian Jackson

      Hey Steve! Javascript minification under Cache Enabler settings needs to be turned off to work with Disqus. We suggest only minifying HTML if you want to use Disqus. However, to speed up Disqus dramatically we recommend trying the free Disqus Lazy Load plugin. See our results with it: https://www.keycdn.com/community/t/lazy-load-wordpress-disqus-comments/184 Then under Disqus Lazy Load plugin just make to turn on “caching support”. Great combination.

  9. Mic

    Getting this error after installation plugin conform video, what should i do?

    Cache Enabler – WordPress Cache

    [resolved] “Path is not valid.” error

    Website is gone.

    1. Cody

      Is there a cache folder in your wp-content/ directory? If not, try to manually add the folder which should resemble: /path/to/your/wpsite/wp-content/cache/cache-enabler/

  10. Jeremy Jay Zahner

    Hey Guys!

    Sadly, cache enabler seems to fail handling srcset properly:

    Lets say i have something like this:

    srcset=”
    {{ TimberImage(person.portrait).get_src(‘263-326’)}} 263w,
    {{ TimberImage(person.portrait).get_src(‘526-652’)}} 526w,

    Which of course results in something like this:

    srcset=”/app/uploads/2016/02/mister-263×326.jpg 263w, /app/uploads/2016/02/mister-526×652.jpg 526w

    And then ultimately i get this:

    srcset=”https://cdn.DOMAIN.ch/app/uploads/2016/02/mister-263×326.jpg 263w, /app/uploads/2016/02/mister-526×652.jpg 526w

    So somehow it seems that only the first Path/Url in the srcset attribute gets processed.

    1. Cody

      Hey Jeremy, are you using CDN enabler to rewrite your static file URLs? If so, do you have the “Enable CDN for relative paths” option enabled?

      1. Jeremy Jay Zahner

        Hi @CodyArsenault:disqus.

        Yes and yes. =)

        The rewriting of paths works. But just for the first path in an srcset attribute.

        1. Cody

          Hmm. Are you running the most recently updated WordPress / plugin versions? Also have you checked if this issue is perhaps being caused due to another conflicting plugin? The same CDN enabler and Cache enabler combination is being used on this site with all srcset paths being rewritten.

          1. Jeremy Jay Zahner

            Yep, all most recent.

            I have no idea what the problem might be. Only that in most cases even on the site it works just fine, just inside the srcset attribute it does not. It even depends on wether or not i add a line break inside my srcset attribute declaration in my source code.

          2. Sven

            Have you tried to remove that space? Also make sure the clear the Cache Enabler after such changes.

            srcset=” /app/uploads… -> srcset=”/app/uploads…

  11. Vitaliy Kolos

    Great documentation, guys. When I just installed the plugin, it was not exactly clear what certain checkboxes do and how exactly it works. Having ready the page, I’m most definitely confident that I know what I need to do (what to configure and how exactly to go about doing so) in order to efficiently use your plugin. Thanks a bunch!

  12. Heiko Mitschke

    Hi!

    Thanks for this great plugin and documentation!

    Is it possible to remove the srcset-attributes, which were added by Cache Enabler? I removed them from WordPress but now Cache Enabler adds them on img-tags.

    Heiko

    1. Sven

      The Cache Enabler should not add the srcset attribute. Did you clear the cache after you made the change?

      1. Heiko Mitschke

        Yes, I did. The first view (uncached) of my site does not contain “srcset”. But the second, compressed view does contain srcset. That is, why I thought, this was added by Cache Enabler. Is there another possibilty?

        1. Sven

          I guess this is related how you filtered/removed the srcset. The Cache Enabler might still see (cache) them.

          1. Heiko Mitschke

            I use Cache Enabler and Optiumus together. The empty srcset-attributes appear in my source code if the browser supports webp-images. JPGs are without any srcset.

            And I discovered where it comes from:

            cache_enabler_disk.class.php: line 533 to 535
            // convert srcset attributes
            $srcset = $img->getAttribute(‘srcset’);
            $img->setAttribute(‘srcset’ , self::_convert_webp_srcset($srcset));

            I changed to:
            // convert srcset attributes
            if($img->hasAttribute(‘srcset’)){
            $srcset = $img->getAttribute(‘srcset’);
            $img->setAttribute(‘srcset’ , self::_convert_webp_srcset($srcset));
            }

            And now it works fine. I do not want to modify your plugin (especially on every update) but maybe it could be possible to add this feature to avoid empty srcsets!? 🙂

          2. Sven

            Thanks for the feedback! We will add this to the next release, which should be next week.

  13. Jochen

    The Advanced Configuration snipped is not working for me. I get a 500 error page, after including the lines to my .htaccess.

          1. Jochen

            Thank you, its working now.
            I assume, I can remove the two “# webp HTML file” blocks, if I don’t want to use the webp images?

            thanks
            Jochen

  14. winhelponline

    Great plugin and I’m already seeing nice results. But I’m wondering how does the Plugin treat query strings in URLs as well as additional stuff in URL such as:

    example . com/sample-post/comment-page-1
    example . com/sample-post/comment-page-1/#comment-155392
    example . com/sample-post/comment-page-1/?preview=false

    Do they serve the same static html file in the above cases, or pass the loading work to PHP? And I’m using your .htaccess code.

    Thanks, KeyCDN.

      1. winhelponline

        Thanks for the info, Sven. So it means when someone clicks the related links generated by Jetpack Related Posts, the page is not taken from cache? Jetpack adds strings such as this:

        ?relatedposts_hit=1&relatedposts_origin=1400@relatedposts_position=2

        I tried Fiddler but I can’t tell whether the page is served from cache or PHP.

  15. Brian Jackson

    Leverage browser caching is actually slightly different and Cache Enabler won’t fix that. You can fix this for your images by simply adding a snippet on your webserver. See here: https://www.keycdn.com/support/leverage-browser-caching/

    Some of those warnings are also coming from Google Fonts and Google Analytics which are hosted on Google’s server, not your own. This means you don’t have any control over their caching. But we have written up a few ways you can gain full control over the caching:
    #1 Host Google Fonts on your own CDN or webserver: https://www.keycdn.com/blog/google-fonts-cdn/
    #2 Host Google Analytics on your CDN or webserver:
    https://www.keycdn.com/blog/local-analytics/

    Hopefully that helps!

  16. Richard Lazazzera

    Hey, I’m using KeyCDN, Optimus (Images converted to WebP), and Cache Enabler. Everything works great, EXCEPT, as soon as I click the box in Cache Enabler to turn on delivery of WebP images, it breaks most of my site (in Chrome) including the homepage and all blog posts.

    You can see the exact effects by going to abetterlemonadestand.com and abetterlemonadestand.com/staging

    These sites are mirrored, the only difference being the one checkbox in Cache Enabler for WebP support on the staging site.

    Any thoughts on how to correct this?

    1. Brian Jackson

      I’m curious, maybe you don’t have the MIME type, WebP enabled on your webserver? Usually it is enabled by default, but I would double check with your host. I have come across a few people who had similiar issues to yours and the MIME type wasn’t enabled. I can see on your staging site that it is generated the WebP version with Cache Enabler, so that part is working. Another thing to try, is disabling the CDN on your staging site temporarily. Possibly a directory gone wrong here as I see things on staging point to production CDN as well as your main site.

      1. Richard Lazazzera

        Thanks for the reply Brian. I tried disabling the CDN on the Staging site and still no effect. I asked my host about MIME type and they said they will get back to me Monday.

  17. Gulshan Kumar

    Hi Brian,

    I tried this plugin two-three times. Resultant, I found that my Page Load time increased instead of decreasing. So, I thought to try the .htaccess code but it fallen back to 403 error.

    My main motto and expectation from this plugin is to serve static mode from cached directory. I hope, if this will be possible I may get significant improvement in load time.

    Before, I have also used W3TC, but there also I didn’t feel satisfied. I’m hoping that, this plugin may help in improving performance.

    I love tweaking so I did a case study at very basic level, firstly I copied whole source code and created a demo.html and when I compared its loading time with original WordPress page. The first byte response time was quite awesome in static HTML mode. 🙂

    Feeling excited, if this could possible with Cache Enabler, it would be great.

    Regards,
    Gulshan

    1. Cody

      Your /wp-admin pages should not be getting cached with Cache Enabler. The plugin does not cache pages if you are logged in, which is necessary in order to access wp-admin pages. Have you double checked your /wp-content/cache/cache-enabler/ directory to verify this?

  18. Jan R

    Love the Cache Enabler plugin, after using WP-Super-Cache for years.

    For the advanced configuration, I have Windows Server IIS URL Rewrite rules ready from my WPSC time, that also work with Cache Enabler. This allows you to directly rewrite requests to cached HTML-files, in stead of needing PHP and WordPress’ internal rewrites for this. This speeds up requests and your site.

    You need help from your IIS systems administrator in allowing server variables through IIS Manager > URL Rewrite though. You may find my older WPSC URL Rewrite rules here: https://www.saotn.org/serve-gzipped-static-wp-super-cache-files-on-iis/. I do have to update them for Cache Enabler asap, but they work 🙂 .

    1. Sven

      Hey Jan, thanks a lot for the advanced snippet for IIS. I’m sure this will boost WordPress for many users out there.

      Looking forward to the dedicated configuration for the Cache Enabler on IIS 🙂

      1. Jan R

        Thanks Sven.
        I have some blog posts to write -for others- first, but I’ll have a look at it asap. I’m sure I only have to delete a few WPSC specific rewrite rules.

      2. Jan R

        The following IIS URL Rewrite rules should work. I have not converted the webP rules, only the default HTML rule. The rules are split up into: HTTPS + gzip, HTTPS without gzip, HTTP with gzip, and HTTP without gzip. There is a prerequisite for gzip encoding though, you need some help from your IIS administrator.

        I have these rules on two sites now, without any problems. Changing rewrites into redirects gives me a redirect on matched cache-files, meaning they work. I would love it if anyone else is able to test these rules as well.

        <!-- Add above WordPress' default URL Rewrite rule -->
        <rule name="Saotn.org_Cache_Enabler_HTTPS_gzip" stopProcessing="true">
        <match url="^(.*)" ignoreCase="false" />
        <conditions logicalGrouping="MatchAll">
        <add input="{URL}" pattern="^(.*)$" />
        <add input="{URL}" pattern="^/wp-admin/.*" negate="true" />
        <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
        <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" />
        <add input="{HTTP_COOKIE}" pattern="(wp-postpass|wordpress_logged_in|comment_author)_" negate="true" />
        <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" />
        <add input="{HTTPS}" pattern="on" ignoreCase="true" negate="false" />
        <add input="{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/{HTTP_HOST}/{R:1}/index.html.gz" matchType="IsFile" />
        </conditions>
        <serverVariables>
        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
        <set name="HTTP_ACCEPT_ENCODING" value="" />
        </serverVariables>
        <action type="Rewrite" url="/wp-content/cache/cache-enabler/{SERVER_NAME}/{R:1}/index.html.gz" />
        </rule>

        <rule name="Saotn.org_Cache_Enabler_HTTPS_html" stopProcessing="true">
        <match url="^(.*)" ignoreCase="false" />
        <conditions logicalGrouping="MatchAll">
        <add input="{URL}" pattern="^(.*)$" />
        <add input="{URL}" pattern="^/wp-admin/.*" negate="true" />
        <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
        <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" />
        <add input="{HTTP_COOKIE}" pattern="(wp-postpass|wordpress_logged_in|comment_author)_" negate="true" />
        <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" negate="true" />
        <add input="{HTTPS}" pattern="on" ignoreCase="true" negate="false" />
        <add input="{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/{SERVER_NAME}/{R:1}/index.html" matchType="IsFile" />
        </conditions>
        <action type="Rewrite" url="/wp-content/cache/cache-enabler/{SERVER_NAME}/{R:1}/index.html" />
        </rule>

        <rule name="Saotn.org_Cache_Enabler_HTTP_gzip" stopProcessing="true">
        <match url="^(.*)" ignoreCase="false" />
        <conditions logicalGrouping="MatchAll">
        <add input="{URL}" pattern="^(.*)$" />
        <add input="{URL}" pattern="^/wp-admin/.*" negate="true" />
        <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
        <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" />
        <add input="{HTTP_COOKIE}" pattern="(wp-postpass|wordpress_logged_in|comment_author)_" negate="true" />
        <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" />
        <add input="{HTTPS}" pattern="on" ignoreCase="true" negate="true" />
        <add input="{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/{SERVER_NAME}/{R:1}/index.html.gz" matchType="IsFile" />
        </conditions>
        <serverVariables>
        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
        <set name="HTTP_ACCEPT_ENCODING" value="" />
        </serverVariables>
        <action type="Rewrite" url="/wp-content/cache/cache-enabler/{SERVER_NAME}/{R:1}/index.html.gz" />
        </rule>

        <rule name="Saotn.org_Cache_Enabler_HTTP_html" stopProcessing="true">
        <match url="^(.*)" ignoreCase="false" />
        <conditions logicalGrouping="MatchAll">
        <add input="{URL}" pattern="^(.*)$" />
        <add input="{URL}" pattern="^/wp-admin/.*" negate="true" />
        <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
        <add input="{QUERY_STRING}" pattern=".*=.*" negate="true" />
        <add input="{HTTP_COOKIE}" pattern="(wp-postpass|wordpress_logged_in|comment_author)_" negate="true" />
        <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" negate="true" />
        <add input="{HTTPS}" pattern="on" ignoreCase="true" negate="true" />
        <add input="{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/{SERVER_NAME}/{R:1}/index.html" matchType="IsFile" />
        </conditions>
        <action type="Rewrite" url="/wp-content/cache/cache-enabler/{SERVER_NAME}/{R:1}/index.html" />
        </rule>

        <!-- Add beneath WordPress' default rewrite rule, beneath "</rules>" -->
        <outboundRules rewriteBeforeCache="false">

        <rule name="RestoreAcceptEncoding" preCondition="NeedsRestoringAcceptEncoding">
        <match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" />
        <action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
        </rule>

        <rule name="SetContentEncodingheaderGzip" preCondition="IsGZ" stopProcessing="true">
        <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
        <conditions>
        <add input="{REQUEST_URI}" pattern=".gz$" />
        </conditions>
        <action type="Rewrite" value="gzip" />
        </rule>

        <preConditions>
        <preCondition name="IsGZ">
        <add input="{PATH_INFO}" pattern=".gz$" />
        </preCondition>
        <preCondition name="NeedsRestoringAcceptEncoding">
        <add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
        </preCondition>
        </preConditions>

        </outboundRules>

        Caveat: if you want to serve index.html.gz files through IIS, your server administrator must add the server variables HTTP_ACCEPT_ENCODING and HTTP_X_ORIGINAL_ACCEPT_ENCODING if you’re not allowed to do so.

        These server variables can be added through IIS Manager > URL Rewrite > View Server Variables in the Actions menu > Add.

        I’ve updated my own post with these rules: https://www.saotn.org/serve-gzipped-static-wp-super-cache-files-on-iis/#Cache_Enabler_WordPress_Plugin_Rewrites

        //edit: HTTPS rules missed a condition:

        <add input="{HTTPS}" pattern="on" ignoreCase="true" negate="false" />

  19. Brett Jackson

    Love this plugin, having one issue lately though. I’m running Gravity Forms and when using the the ‘Advanced Config’ snippet for Apache in my .htaccess file, any form on the home page specifically won’t submit or validate and the page is still cached. It seems to be ignoring the POST method condition check in the snippet. Any other page works fine to submit a form and render the non cached version of the page on POST, just the home page that isn’t behaving. Any ideas?

      1. Brett Jackson

        I tried that, but the forms still break on the home page. Even with just basic caching turned on, it still won’t render the non cached version of the page on POST for the home page specifically which causes the validation and submission to not work.

        1. Cody

          Have you tried using a different theme or disabling other plugins to check if there might be a conflict somewhere? You could also exclude that specific page ID from being cached if required.

          1. Brett Jackson

            I have tried disabling everything, and nothing seems to fix it. I do have to use your Advanced Config Snippet for Apache to force the rendering of the cached version of the pages, and if I take the snippet out, the form submits fine. The form also submits fine on any other page with the snippet in place in the .htaccess file.

            I have already turned off caching on the home page specifically to allow the form to work, I was just hoping to find an .htaccess fix to get it to register the POST condition correctly, as I would like to cache my home page if possible.

          2. Sven

            An exclusion of the home site via the htaccess file is not something that we can provide but you can modify the htaccess files as per your needs.

  20. Brent Sparks

    This is by far the best caching plugin I’ve experienced on my WP sites. That being said, I’ve noticed that when I fetch and render in Google Search Console while having “Cache Minification” enabled the html it is not being shown. I’m curious if anyone else has seen this behavior. I would surely like to use minification as it does reduce load time. But not at the expense of googlebot being unable to read my html.

  21. Alex

    Hi,

    I have a .js widget that is in an iframe and loading from a different website but when the cache enabler plugin is active the widget doesnt work properly( sometimes the widget is visible and sometimes not).

    Does cache enabler stops external .js files for updating? Is there a workaround?
    *in the plugin settings i have everything checked with html cahing enabled.

    Thanks

    1. Cody

      Can you provide an example where this is happening (e.g. a link to your website)? Also if the widget on appears on certain pages / posts you can exclude by ID.

  22. Fadhilah Afif

    Hello,

    i got this from checking my website “x-cache-handler: wp”. In my server is the advanced snippet working? or is it even the plugin itself not work?

    Regards,

    Fadhilah A.

      1. Fadhilah Afif

        Hello Cody,

        I have another question, if advance configuration are being used by default, does that mean, i don’t have to add custom nginx configuration to my server, nor do i have to set cron job from my server right? If i still have to do that, can i still use exclude page or post using id from cache enabler wordpress panel?

        1. Cody

          Correct, the default setup will satisfy the majority of use-cases. You won’t have to add the custom snippet nor set a cron job. You can continue using the exclude feature within the Cache Enabler settings.

          1. George Liu

            Can you clarify that the new default advanced config means bypass php handling when used with nginx? So that nginx handles caching. The documentation is unclear as to is now required to setup php bypass caching. So the nginx additional snippets are no longer needed to bypass php handling?

          2. Cody

            The new default setup bypasses most of the PHP handling, whereas the advanced snippet bypasses all PHP handling. Although the performance benefits of implementing the advanced snippet are quite minimal, it still is the fastest approach (however we only recommend it for advanced users).

      2. Phil Braun

        Hi Cody,
        do I understand correctly: to bypass PHP entirely, one does not have to use the advanced snippet for NGiNX or Apache at all anymore, and the “x-cache-handler: wp” header can be present?
        In your link it says “If the X-Cache-Handler header is not present, then your advanced configuration snippet is properly implemented.” which sounds to me like it should not be present.
        Sorry for the dumb question and thanks, Phil

        1. Cody

          Cache Enabler comes with a default advanced configuration file and if the plugin uses that, you will see the x-cache-handler: wp header. This setup bypasses most of the PHP, not all, but very close. The advanced configuration snippet bypasses all PHP and for this you need to implement the Nginx or Apache snippet above. In this case you won’t see the header at all.

          1. Phil Braun

            Cool, thanks a bunch Cody for clearing that up (and in absolute record time, too!)

  23. itmark

    My site writes abrakadabra simbols as i switch on this plugin. It is in russian. Is there any button to solve this problem?

    1. Cody

      What is the default charset you are using? Can you ensure that your php.ini file uses utf-8? This can also be defined in .htaccess as AddDefaultCharset utf-8

  24. Nils

    Hi there, I am having a problem when I am using the advanced code you are providing for the .htaccess.

    I am using Woocommerce and if I don’t use the code, it works, but if I add it to my .htaccess, I cannot add anything to my cart – instead of the cart the product page is displayed, even if I disable caching for cart and checkout page.

    I have a piece of code that you provided about a year ago and it is a bit different, and this code still works w/o problems, so I was wondering if I cn still use the old code. It is this one:

    # BEGIN Cache Enabler

    RewriteEngine On

    # gzip HTML file
    RewriteCond %{REQUEST_URI} /$
    RewriteCond %{REQUEST_URI} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =””
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz -f
    RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz [L]

    AddType text/html .gz
    AddEncoding gzip .gz

    # default HTML file
    RewriteCond %{REQUEST_URI} /$
    RewriteCond %{REQUEST_URI} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =””
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html -f
    RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html [L]

    # END Cache Enabler

    Also, I noticed that there still is a problem with the stock status – a product is still displayed as being in stock when the page is cached…

    Thank you for your help!

    1. Cody

      Do you have the most recent version of Woocommerce? There was an issue with Woocommerce and caching in one of their older versions. Also what version of Apache are you using? We have 2 difference advanced snippets to choose from depending on your Apache version.

      If upon updating your Woocommerce plugin (if applicable) and using the correct advanced snippet it continues to not work, then there may be a conflict with your setup or another plugin. In this case, you can simply not use the advanced snippet at all. In our most recent update of Cache Enabler we have made significant improvements and the advanced snippet only produces a very very minimal speed enhancement.

      1. Nils

        Thanks. Yes, I am using the most recent version of Woo and Apache.
        So I should not use the old code you provided? Also, what about the stock staus issue?

  25. joe pierce

    Hello, I’m getting an error when I activate cache enabler on my server that is running php7. Here is the error message. Can you fix this or suggest a hack so I can?

    FILE: /var/www/html/wp-content/plugins/cache-enabler/inc/cache_enabler.class.php
    ——————————————————————————–
    FOUND 1 ERROR AFFECTING 1 LINE

    ——————————————————————————–
    1265 | ERROR | preg_replace() – /e modifier is forbidden since PHP 7.0
    ——————————————————————————–

  26. Et Veritas Liberabit Vos

    When I enable bypass PHP on apache, I lost 1 point on gtmetrix, for “Specify a character set early”

    Nothing better, just lost this 1 point. Any idea why?

  27. Janis

    Hey, I am getting an error using the htaccess code for apache. Occasionally the site is being redirected to the cache folder e.g. example.com/wp-content/cache/cache-enabler/[page]/index.html – do you have an idea what to do about it?

    1. Cody

      Which .htaccess snippet are you using? Have you checked your Apache version and implemented the proper snippet? Do you have any steps regarding how the error can be reproduced?

      1. Janis

        I am running the first apache code from above and have Apache 2.4.10 running on my VPS. The weird thing is that it only happens occasionally and e.g. not on all subpages. Do you think the varnish cache might be interfering?

        1. Cody

          Does the issue only occur when using the advanced .htaccess snippet? Perhaps there is something else in your .htaccess file that is conflicting. In this case I would recommend simply using the default setup. It is very close to being on-par with the advanced snippet as far as speed.

  28. Bruno Crosier

    Hey I’ve tried to install this plus premium Optimus account to enable webp but everything seems to still be served as jpeg.. any idea why? Thanks

  29. Bojan Denic

    Hello,

    When I add thix nginx code on my Plesk in Additional nginx directives, I got error:

    Invalid nginx configuration: nginx: [emerg] “server” directive is not allowed here in /var/www/vhosts/system/website.com/conf/vhost_nginx.conf:26 nginx: configuration file /etc/nginx/nginx.conf test failed

    1. Sven

      Please only use the advanced snippet if you know how to configure nginx. The Cache Enabler is also fast enough without the advanced snippet.

  30. Jochen Müller

    I wanted to use cache enabler plugin on my wordpress 4.7 installation but all pages except the homepage were broken (404) afterwards. Disabling the plugin did not help to restore a functional blog. I had to use another permalink setting generating links like https://blog.example.com/?page_id=95 instead of https://blog.example.com/imprint/ but now Bookmarks will be broken. How can I remove the changes the plugin did and use my old permalink setting again? Just switching between settings or rebooting the server etc.. did not work.

    1. Cody

      Do you have any special WordPress setup or configuration? Any .htaccess rules that might be interfering? Also, did you make any other changes at the time of installing Cache Enabler? You may want to also try deactivating other plugins for testing purposes if you haven’t already.

      1. Jochen Müller

        Hi, I solved the problem, it was an apache update which set AllowOverride None. With AllowOverride All the pages show up. But I did only got a little bit pagespeed using the plugin. Using apache mod_pagespeed improved the benchmark much more but breaks the page for IE11. Maybe I will have to switch themes and JS to improve or go static.

  31. Corey Selover

    I tried activating the plugin but it says “The Cache Enabler plugin requires a custom permalink structure to start caching properly. Please go to Permalink to enable it.”

    I don’t know anything about permalink settings. I tried setting it to Custom bit it seems as if I need to do something more than that. Any tips?

  32. raresmihaipopa

    Hi,

    Great plugin, but it seems it doesn’t offer .webp support for style=”background: url(‘…’)” statements. Are there any plans to add this?

    Thank you.

  33. Sebastian Brinkmann

    Hi!
    I running your Cache Enabler and added the advanced-configuration in my .htaccess (running Apache 2.4 at 1&1), but I still see “x-cache-handler: wp”. Without this htaccess-entry the download time is a bit higher then before with Cachify. So, I hoped to get the best download rate with this .htaccess-entry.
    Thanks
    Sebastian

    1. Sven

      Please note that you need to update the htaccess config so that it works for your setup (the paths need to match). The snippet isn’t working correctly if you can see the “x-cache-handler” header. We don’t recommend to use the advanced snippet if you don’t know how to modify it. The speed difference is very small compared to the increased complexity.

  34. Niclas Strindell

    Thanks for a great plugin. I’m using it together with Autoptimize and I’ve found that I get best results when letting Cache Enabler do the html/js minification, and Autoptimize the css. The setup works fine, but please tell me how to get rid of this annoying notification:
    “The Autoptimize plugin is already active. Please disable minification in the Cache Enabler settings.”

      1. Niclas Strindell

        That means I can’t use this setup on a clients website. Hope you can give us such an option in the future.

  35. Viktor Nagornyy

    Quick question. If we’re using Apache with Nginx in front of it to handle static resources, should we use htaccess or nginx.conf advance configuration to bypass php? I assume htaccess since Apache handles PHP, but wanted to confirm. Thanks.

      1. Viktor Nagornyy

        Thanks Cody. I noticed weird behavior on one site where we have a redirect setup for non-www to www. The site works fine with www, but when we add a redirect for non-www, it begins to download index.html.gz instead of a clean redirect. It looks like it’s accessing cached page for some reason.

        So I re-ordered them, I put WP redirects at the top of htaccess and Cache Enabler advance redirects below it. It works fine now. Is this something you’ve encountered before? Here’s how the redirect was setup:

        # BEGIN WordPress

        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^example.com [NC]
        RewriteRule ^(.*)$ hXXs://www.example.com/$1 [L,R=301]
        RewriteBase /
        RewriteRule ^index.php$ – [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]

        # END WordPress

        When we check it with curl, we see that it’s catching cached page:

        # curl -v https:// example.com

        The document has moved here.

        Just FYI, we got Apache with Nginx and Pagespeed.

        Any thoughts? Thanks!

        Edit: I replaced http with hXXt, added space in curl request, and wrapped [a] in brackets to prevent Disqus from turning them into hyperlinks.

          1. Viktor Nagornyy

            Thanks. I was able to fix this by moving non-www to www redirect inside cache enabler’s rewrites, instead of WP’s.

            # BEGIN Cache Enabler

            RewriteEngine On
            RewriteCond %{HTTP_HOST} ^example.com [NC]
            RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
            RewriteBase /

  36. Benjamin Fontanelli

    Hi!
    The plugin works like a charm!
    There’s only one thing I can’t figure out: Is it possible to cache search pages aswell?
    I redirected with wp_redirect from /?s= to /search/ but now I have no clue how to go further…

    I have a lot of search queries with the same keywords so it would be great to cache the result pages aswell.
    Any ideas/suggestions?

    Thanks in advance!
    Benjamin

    1. Cody

      Hey Benjamin, caching the search results pages is currently not possible as all search pages are excluded as defined within the inc/cache_enabler.class.php file.

      1. Benjamin Fontanelli

        Hey Cody!
        Thanks for the hint, now I found the part which excludes the search result pages. Thanks! :=)

  37. Adam Barnes

    We’re running WP in a scaling group on AWS, and looking to add this plugin to improve TTFB. One problem is that the static files are stored and served locally, meaning there will be x slow requests, where x is the number of instances we have running at the time.

    Is there a way to get this to upload the generated html to S3, and get apache to serve from there if it exists instead?

Leave A Comment?