0
在https://bm-translations.de我試圖通過的.htaccess激活的gzip壓縮和瀏覽器緩存:htaccess的gzip和瀏覽器緩存
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ./[L,R=301]
# FORCE HTTPS
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://bm-translations.de/$1 [L,R=301]
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
<IfModule mod_filter.c>
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE\s7 !no-gzip !gzip-only-text/html
</IfModule>
</IfModule>
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</ifModule>
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
ExpiresByType image/x-icon "access plus 21600000 seconds"
ExpiresByType image/jpeg "access plus 21600000 seconds"
ExpiresByType image/png "access plus 21600000 seconds"
ExpiresByType image/gif "access plus 21600000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 21600000 seconds"
ExpiresByType text/javascript "access plus 21600000 seconds"
ExpiresByType application/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>
出於某些原因頁高速洞察依然呈現出既沒有被激活,你可以看到這裏:https://developers.google.com/speed/pagespeed/insights/?hl=de&url=https%3A%2F%2Fbm-translations.de
我在做什麼錯在這裏?或者是否有可能將資源上載爲gzip,或者是否會導致錯誤?
這個作品,非常感謝你!但仍然存在緩存問題。 –
這很棒,我看到該網站現在是gzipped。有關緩存,請參閱以下https://codepen.io/anon/pen/dzzBvW –