W3 Total Cache Error: Page Cache Rewriting is URL Not Working

wordpress blue and white and grey logo

If you are using WordPress for your blog and trying to setup W3 Total Cache, you may find that on your Administration page, you are getting this error:

“W3 Total Cache Error: Page Cache Rewriting is URL Not Working. Please verify that the server configuration allows .htaccess”

w3 error

There can be a few reasons for this but you can try this fix to see if it works for you….

First of all, you will need to edit the .htaccess file located in the root of your blog. Once opened you need to ensure that the text you need to add is placed at the very top of the file – this part it critical, do not place towards the end of the file, it absolutely must be at the top, this includes the built in WordPress text like this:

 # BEGIN WordPress  
 <IfModule mod_rewrite.c>  
 RewriteEngine On  
 RewriteBase /  
 RewriteRule ^index.php$ - [L]  
 RewriteCond %{REQUEST_FILENAME} !-f  
 RewriteCond %{REQUEST_FILENAME} !-d  
 RewriteRule . /index.php [L]  
 </IfModule>  
 # END WordPress  

So, above the text above, add the following text:

 # BEGIN W3TC Browser Cache  
 <IfModule mod_deflate.c>  
   <IfModule mod_headers.c>  
     Header append Vary User-Agent env=!dont-vary  
   </IfModule>  
     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_mime.c>  
     # DEFLATE by extension  
     AddOutputFilter DEFLATE js css htm html xml  
   </IfModule>  
 </IfModule>  
 # END W3TC Browser Cache  
 # BEGIN W3TC Page Cache core  
 <IfModule mod_rewrite.c>  
   RewriteEngine On  
   RewriteBase /  
   RewriteRule ^(.*/)?w3tc_rewrite_test/?$ $1?w3tc_rewrite_test=1 [L]  
   RewriteCond %{HTTP:Accept-Encoding} gzip  
   RewriteRule .* - [E=W3TC_ENC:_gzip]  
   RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]  
   RewriteRule .* - [E=W3TC_PREVIEW:_preview]  
   RewriteCond %{REQUEST_METHOD} !=POST  
   RewriteCond %{QUERY_STRING} =""  
   RewriteCond %{REQUEST_URI} /$  
   RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]  
   RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f  
   RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]  
 </IfModule>  
 # END W3TC Page Cache core  

So your .htaccess file should end up looking something like this:

 # BEGIN W3TC Browser Cache  
 <IfModule mod_deflate.c>  
   <IfModule mod_headers.c>  
     Header append Vary User-Agent env=!dont-vary  
   </IfModule>  
     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_mime.c>  
     # DEFLATE by extension  
     AddOutputFilter DEFLATE js css htm html xml  
   </IfModule>  
 </IfModule>  
 # END W3TC Browser Cache  
 # BEGIN W3TC Page Cache core  
 <IfModule mod_rewrite.c>  
   RewriteEngine On  
   RewriteBase /  
   RewriteRule ^(.*/)?w3tc_rewrite_test/?$ $1?w3tc_rewrite_test=1 [L]  
   RewriteCond %{HTTP:Accept-Encoding} gzip  
   RewriteRule .* - [E=W3TC_ENC:_gzip]  
   RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]  
   RewriteRule .* - [E=W3TC_PREVIEW:_preview]  
   RewriteCond %{REQUEST_METHOD} !=POST  
   RewriteCond %{QUERY_STRING} =""  
   RewriteCond %{REQUEST_URI} /$  
   RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]  
   RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f  
   RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]  
 </IfModule>  
 # END W3TC Page Cache core  
 # BEGIN WordPress  
 <IfModule mod_rewrite.c>  
 RewriteEngine On  
 RewriteBase /  
 RewriteRule ^index.php$ - [L]  
 RewriteCond %{REQUEST_FILENAME} !-f  
 RewriteCond %{REQUEST_FILENAME} !-d  
 RewriteRule . /index.php [L]  
 </IfModule>  
 # END WordPress  

You should then save your .htaccess file and overwrite the existing one on your blog server.

Now, if you go back into your WordPress blog administration page, you should now find that the W3 Total Cache Page Cache Writing is now fully working!

2

COMMENTS

If you have any questions or are struggling in any way with this, please feel free to leave us a message below using our comments system.

Free Subscription!Subscribe to our site to receive updates via email!

Enter your email address below and click the Subscribe button to receive email notifications about new and exciting downloads available through our website at https://www.techygeekshome.com

You will also receive notifications about new technical guides, latest news and MSI installer downloads that are available through our blog here at https://blog.techygeekshome.info 

We will not spam you and we will not pass on any of your details to anyone else. We tend to post new content once or twice a week.

Join 233 other subscribers

You can unsubscribe any time you like.

About A.J. Armstrong

Founder of TechyGeeksHome and Head Editor for over eight years! IT expert in multiple areas for over 20 years. Sharing experience and knowledge whenever possible! Making IT Happen.

View all posts by A.J. Armstrong