Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove X-Powered-By
add_filter( 'rocket_htaccess_files_match', function( $rules ) {
$rules = '<IfModule mod_alias.c>' . PHP_EOL;
$rules .= '<FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$">' . PHP_EOL;
$rules .= '<IfModule mod_headers.c>' . PHP_EOL;
$rules .= 'Header unset Pragma' . PHP_EOL;
$rules .= 'Header append Cache-Control "public"' . PHP_EOL;
$rules .= 'Header unset Last-Modified' . PHP_EOL;
$rules .= '</IfModule>' . PHP_EOL;
$rules .= '</FilesMatch>' . PHP_EOL . PHP_EOL;
$rules .= '<FilesMatch "\.(css|htc|js|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">' . PHP_EOL;
$rules .= '<IfModule mod_headers.c>' . PHP_EOL;
$rules .= 'Header unset Pragma' . PHP_EOL;
$rules .= 'Header append Cache-Control "public"' . PHP_EOL;
$rules .= '</IfModule>' . PHP_EOL;
$rules .= '</FilesMatch>' . PHP_EOL;
$rules .= '</IfModule>' . PHP_EOL . PHP_EOL;
return $rules;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment