How to enable compression and website caching in htaccess

Categories

We make edits to the .htaccess file, put the following redirects in front of the redirect to the admin panel

 # Caching / not supported on all hosting
< ifmodule mod_expires.c >
< filesmatch " \. (jpg | jpeg | png | gif | js | css | swf | ico | woff | mp3) $ ">
ExpiresActive on
ExpiresDefault " access plus 7 days "
</ filesmatch >
</ ifmodule >

# Gzip compression / not supported on all hosting
< ifmodule mod_deflate.c >
AddOutputFilterByType DEFLATE application / javascript
AddOutputFilterByType DEFLATE text / javascript
AddOutputFilterByType DEFLATE text / css
< ifmodule mod_setenvif.c >
BrowserMatch ^ Mozilla / 4 gzip-only-text / html
BrowserMatch ^ Mozilla / 4 \ .0 [678] no-gzip
BrowserMatch \ bMSIE! No-gzip! Gzip-only-text / html
</ ifmodule >
</ ifmodule >

# Google PageSpeed Insights PageSpeed module, is not available on all hosting services and may not work everywhere, you need to check with the hosters
< IfModule pagespeed_module >
ModPagespeed on
ModPagespeedRewriteLevel CoreFilters
ModPagespeedEnableFilters make_google_analytics_async
ModPagespeedEnableFilters prioritize_critical_css
ModPagespeedEnableFilters defer_javascript
ModPagespeedEnableFilters sprite_images
ModPagespeedEnableFilters convert_png_to_jpeg, convert_jpeg_to_webp
ModPagespeedEnableFilters collapse_whitespace, remove_comments
</ IfModule >
Comments 2
Гуру блят
31.12.2019, 18:41
Alex, как вариант просто переименуй файл css и браузер его автоматом перезапишет.
Alex
02.12.2019, 10:39
А если мне нужно будет сбросить кэш? Например, для перезаписи css. Как это сделать?
Write your comment
log in
Download OkayCMS
version 4.5.0
Subscribe to the newsletter
You will receive a selection of useful articles on working with the site on OkayCMS, discounts on modules and templates