Forbidden access minified CSS & JS – W3TC
-
Yesterday, I migrated my WordPress site to a new Ubuntu installation. After the migration was successful, I enabled W3TC and it messed up the whole css. First I thought it was just CSS but then when I explored found that it is not just with css but js too.
It has something to do with the minify folder.
For instance, when I viewed the generated source code and tried to view the following link: https://website.com/assets/cache/minify/000000/ZYxbCoUwDEQ3VG8UrguKaX2gTUoSUXev-CGIfzNnONNCRBsnErZfnjj8wa82d7I_ITQQZeNFMFYZGYekQGbQq7CHGkhXprFoKjfuRNxcsdx_r9n8WNLXoNVc8gk.css
I get this error:
Forbidden You don't have permission to access /assets/cache/minify/000000/ZYxbCoUwDEQ3VG8UrguKaX2gTUoSUXev-CGIfzNnONNCRBsnErZfnjj8wa82d7I_ITQQZeNFMFYZGYekQGbQq7CHGkhXprFoKjfuRNxcsdx_r9n8WNLXoNVc8gk.css on this server.
I knew the issue must be with .htaccess and found the problem to with the code W3TC injects into the file.
# BEGIN W3TC Page Cache core <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTPS} =on RewriteRule .* - [E=W3TC_SSL:_ssl] RewriteCond %{SERVER_PORT} =443 RewriteRule .* - [E=W3TC_SSL:_ssl] 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 %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC] RewriteCond "%{DOCUMENT_ROOT}/assets/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f RewriteRule .* "/assets/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L] </IfModule> # END W3TC Page Cache core
Any help to resolve the issue is much appreciated ??
- The topic ‘Forbidden access minified CSS & JS – W3TC’ is closed to new replies.