[Plugin: W3 Total Cache] Minify Rewrite Error Found (Fix Here)
-
Hey all. I have been pounding my head against a wall for the last few days trying to figure out what configuration problems were preventing me from getting Minify rewrites working, which in turn prevents uploading minified files to a CDN.
My shared hosting account forced me to install my account attached domain name at the base of the public_html directory. This would mean that all the WP directories would be mixed in with the directories of my other websites. So I installed WP in a directory. So my website’s file structure is like this:
https://www.domain.com
https://www.domain.com/wp/wp-contentThe problem is the way W3TC tests for the minify rewrite ability. It doesn’t take into account the auxiliary directories that WP might be installed into.
Here is the fix I have made in my code. Frederick might want to change it for official inclusion to the plugin and that’s fine with me. I just hope this fix get’s included so I don’t have to hack any updates to correct the issue.
FIX:
wp-content/plugins/w3-total-cache/inc/define.php
add this line after WP_CONTENT_DIR_PATH is defined (line 41 in my file)define('WP_AUX_INSTALL_DIR', (strcasecmp($_SERVER['DOCUMENT_ROOT'], WP_CONTENT_DIR_PATH) == "") ? "" : (ltrim(str_ireplace($_SERVER['DOCUMENT_ROOT'], '', WP_CONTENT_DIR_PATH), '/') . '/'));
wp-content/plugins/w3-total-cache/lib/W3/Plugin/TotalCacheAdmin.php
In the function test_rewrite_minify() (line 5275) change:$url = sprintf('%s/%s/w3tc_rewrite_test', w3_get_home_url(), W3TC_CONTENT_MINIFY_DIR_NAME);
to
$url = sprintf('%s/%s%s/w3tc_rewrite_test', w3_get_home_url(), WP_AUX_INSTALL_DIR, W3TC_CONTENT_MINIFY_DIR_NAME);
Now both your Minify rewrites will work and you will be able to upload your minified files to your CDN. Yay!
- The topic ‘[Plugin: W3 Total Cache] Minify Rewrite Error Found (Fix Here)’ is closed to new replies.