• Been looking for the answer but can’t find it. Everytime I try to use W3 Total Cache to minify via Auto mode, the files are referenced in the head of the published page, but they don’t actually ever getting written out to the cache/minify directory. I’ve set the proper permissions to the cache dir and page caching is fine, but cannot get minify to actually write out the files.

    In my head i will get a reference to something like this:

    MY-DOMAIN/wp-content/cache/minify/000000/nVLLcsMgDPyhUJpDZ_o7MsiNWhkxCOI4X18e8SQnd6YndlerFWI42zWahQJB8SSRYcNknapt2qCns8UrhqzGAWPwkExMYhOqlORQ7Ur-C_OzOhfm04f1oBdyEvStZlUOvp5mgtT5X6E50YTm4amlnvr_TrPIRIw94N0GLGi_1epKESe59Y13stfnBAuukn7sLCGbvoqtoVuU7h_w0K3iCPhBWs-9C8cTuChdcYwY-NBfL_HM38ne0TQItEDGV2kSyZoTxJe3mBlvRpl8_QAND2hc0SzL7tO8cUu6cfpMTTHuQuyH_gs.css

    This file does not exist in ../wp-content/cache/minify/000000/ and so we are getting 404.

    If i use Opcode APC cache method (preferred), i get no errors, but no files are written out.

    If i use Data cache method (which i would rather not), I get the following error:

    .htaccess file contains rules to rewrite url MY-DOMAIN/wp-content/cache/minify/000000/w3tc_rewrite_test. If handled by plugin, it returns "OK" message.
    The plugin made a request to MY-DOMAIN/wp-content/cache/minify/000000/w3tc_rewrite_test but received:
    404 Not Found
    instead of "OK" response.

    —————

    What explicit Rewrite rule do I need in .htaccess to make sure that the files are written out?

    thx,
    am

    https://wordpress.org/plugins/w3-total-cache/

Viewing 6 replies - 1 through 6 (of 6 total)
  • For 1 you will want to load the minified files from disk. APC is better suited for Object and Database caching not Page or Minify.

    Can you paste your htaccess file?

    Thread Starter ameet3000

    (@ameet3000)

    # 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
    
    # Keep it on lockdown
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>

    Should i be copying the Rewrite Rules in Performance -> Install of W3TC?

    Thread Starter ameet3000

    (@ameet3000)

    Destac, any insight would be appreciated.

    Sorry about that.. If there are rewrite rules in W3 that it is telling you to copy try copying them into the htaccess file.

    I was having the same issues on apache and it was due to an .htaccess placed in the /wp-content/plugins directory that denied access to *.php files. I believe iThemes security or Sucuri placed it there for protection.

    <Files *.php>
    deny from all
    </Files>

    The problem is that w3tc needs to be able to run plugins/w3-total-cache/pub/minify.php in order to build out the cache files; hence the empty directory.

    Solution:

    I added a .htaccess file in the /plugins/w3-total-cache directory to allow *.php access

    <Files *.php>
    allow from all
    </Files>

    Hope this helps.

    @rkochis you have saved my life!!
    The iThemes Security plugin indeed obstructed direct access to/execution of php files in the wp-contents folder.

    As soons as I added a htaccess file allowing the execution of php files in the /plugins/w3-total-cache directory, the error disappeared

    The plugin made a request to xxx/wp-content/cache/minify/000000/w3tc_rewrite_test but received:
    404 Not Found
    instead of “OK” response.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘W3TC Minify does not create minified files in cache dir’ is closed to new replies.