巧用.htaccess设置网站的压缩与缓存
程序员文章站
2022-04-06 16:37:18
...
巧用.htaccess设置网站的压缩与缓存
原文转载地址:http://www.jb100.net/html/content-22-738-1.html
在网站根目录下的.htaccess文件中添加以下代码
原文转载地址:http://www.jb100.net/html/content-22-738-1.html
原文转载地址:http://www.jb100.net/html/content-22-738-1.html
在网站根目录下的.htaccess文件中添加以下代码
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
ExpiresByType application/x-shockwave-flash A2592000
ExpiresByType text/css A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/javascript A2592000
ExpiresByType text/javascript A2592000
ExpiresByType text/html A600
SetOutputFilter DEFLATE
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.*
Header unset Last-Modified
FileETag none
赶快把它放到你的网站或blog根目录下的.htaccess文件里吧。原文转载地址:http://www.jb100.net/html/content-22-738-1.html
AD:真正免费,域名+虚机+企业邮箱=0元