Plugin Contributor
iSaumya
(@isaumya)
Hi @pgray,
In the latest version of the plugin i.e. v4.6.1 I’ve updated the guide of using WP Rocket with this plugin. Please follow the steps mentioned here to get the best results: https://gist.github.com/isaumya/d5990b036e0ed2ac55631995f862f4b8
Hi Saumya,
Your plugin is fantastic.
For WP Rocket, I saw your gist and I think there’s a little mistake :
add_filter( 'rocket_disable_htaccess', '__return_false' );
It should be __return_true if you want to disable rules in htaccess.
I’m not sure it’s necessary to disable all WP Rocket Rules. If I remove ExpireDefault and ExpireByType text/html rules from WP Rockets, it seem’s OK to me. FYI I use this code below :
function remove_htaccess_html_expire( $rules ) {
$rules = preg_replace( '@\s*ExpiresDefault \s*"access plus \d+ (seconds|minutes|hour|week|month|year)"@', '', $rules );
$rules = preg_replace( '@\s*#\s*Your document html@', '', $rules );
$rules = preg_replace( '@\s*ExpiresByType text/html\s*"access plus \d+ (seconds|minutes|hour|week|month|year)"@', '', $rules );
return $rules;
}
add_filter('rocket_htaccess_mod_expires', __NAMESPACE__ . '\remove_htaccess_html_expire');
Also :
add_filter( 'do_rocket_generate_caching_files', '__return_false' );
line 22 & line 38 are the same.
In any case, what a great job, thanks for this great plugin!
-
This reply was modified 4 years ago by
Reuhno.
-
This reply was modified 4 years ago by
Reuhno.
Plugin Contributor
iSaumya
(@isaumya)
Hi @laboiteare,
Thanks for spotting the mistake and I have fixed the issue in the gist.
Regarding the htaccess rules that WP Rocket adds, you don’t need it as if you want cache control rule for static file you can enable the option for adding browser caching rule option inside the plugin settings under the cache tab: https://i.imgur.com/Anvnipk.jpeg
Thanks @isaumya
You’re right, I will do it in your way! Thanks 🙂