This documentation is only valid for older versions of Wordfence. If you are using Wordfence 7 or later, please visit our new documentation.

I enabled Falcon Caching and my site errors out. What went wrong?

From Wordfence Documentation
Jump to: navigation, search

Note: Falcon caching is no longer supported and is not present in recent versions of Wordfence. See the Falcon Cache page for more details.

This help page has been retained temporarily to help in cases where a site's .htaccess still contains old code from Falcon caching, which normally would have been removed during the update process.

On rare occasions, writing to the htaccess file while enabling Falcon Caching is interrupted. This can result in httpd 500 errors when viewing your site. The quickest way to fix this is to add the Falcon code to it manually.

As always, remember when editing files to make a backup copy of the file you are editing in case you need to undo changes quickly

Below is the code to add at the top of the file:

#WFCACHECODE - Do not remove this line. Disable Web Caching in Wordfence to remove this data.
<IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
        <IfModule mod_headers.c>
                Header append Vary User-Agent env=!dont-vary
        <IfModule mod_mime.c>
                AddOutputFilter DEFLATE js css htm html xml
<IfModule mod_mime.c>
        AddType text/html .html_gzip
        AddEncoding gzip .html_gzip
        AddType text/xml .xml_gzip
        AddEncoding gzip .xml_gzip
<IfModule mod_setenvif.c>
        SetEnvIfNoCase Request_URI \.html_gzip$ no-gzip
        SetEnvIfNoCase Request_URI \.xml_gzip$ no-gzip
<IfModule mod_headers.c>
        Header set Vary "Accept-Encoding, Cookie"
<IfModule mod_rewrite.c>
        #Prevents garbled chars in cached files if there is no default charset.
        AddDefaultCharset utf-8

        #Cache rules:
        RewriteEngine On
        RewriteBase /
        RewriteCond %{HTTPS} on
        RewriteRule .* - [E=WRDFNC_HTTPS:_https]
        RewriteCond %{HTTP:Accept-Encoding} gzip
        RewriteRule .* - [E=WRDFNC_ENC:_gzip]
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{HTTPS} off
        RewriteCond %{QUERY_STRING} ^(?:\d+=\d+)?$
        RewriteCond %{REQUEST_URI} (?:\/|\.html)$ [NC]

        RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|wf_logout|wordpress_logged_in|wptouch_switch_toggle|wpmp_switcher) [NC]

        RewriteCond %{REQUEST_URI} \/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)(.*)$
        RewriteCond "%{DOCUMENT_ROOT}/wp-content/wfcache/%{HTTP_HOST}_%1/%2~%3~%4~%5~%6_wfcache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" -f
        RewriteRule \/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)(.*)$ "/wp-content/wfcache/%{HTTP_HOST}_$1/$2~$3~$4~$5~$6_wfcache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" [L]
#Do not remove this line. Disable Web caching in Wordfence to remove this data - WFCACHECODE