Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save charmoney/b9f99443dbb0000425fb7cba14d1d592 to your computer and use it in GitHub Desktop.
Save charmoney/b9f99443dbb0000425fb7cba14d1d592 to your computer and use it in GitHub Desktop.
Adjust expiration on HTML to prevent WP Rocket issue with DreamPress Varnish cache
<?php
add_filter('rocket_htaccess_mod_expires', 'wp_rocket_adjust_html_expire_dreampress');
/**
* Adjust expiration on HTML to prevent issue with Varnish cache
*
* @param string $rules htaccess rules.
* @return Updated htaccess rules
*/
function wp_rocket_adjust_html_expire_dreampress( $rules ) {
$rules = str_replace(
'ExpiresByType text/html "access plus 0 seconds"',
'ExpiresByType text/html "access plus 1 hour"',
$rules
);
return $rules;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment