【发布时间】:2014-03-09 12:12:04
【问题描述】:
我想问一下如何在 000webhost.com 上的 HTML 模板上进行压缩我创建了 .htaccess 文件并添加了这个:
<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_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
Google 的 PageSpeed Insights 告诉我我没有启用 gzip 压缩,所以我不知道如何正确启用它。
这是我的website
一般来说,我想知道如何提高我网站的性能?嗯,根据 PageSpeed Insights,目前我的网站有 56/100 移动设备和 73/100。
【问题讨论】: