Home >php教程 >php手册 >巧用.htaccess设置网站的压缩与缓存

巧用.htaccess设置网站的压缩与缓存

WBOY
WBOYOriginal
2016-06-07 11:40:181443browse

巧用.htaccess设置网站的压缩与缓存
原文转载地址:http://www.jb100.net/html/content-22-738-1.html

在网站根目录下的.htaccess文件中添加以下代码        <ifmodule> <br>         ExpiresActive On <br>         ExpiresByType image/gif A2592000 <br>         ExpiresByType image/jpeg A2592000 <br>         ExpiresByType image/png A2592000 <br>         ExpiresByType application/x-shockwave-flash A2592000 <br>         ExpiresByType text/css A2592000 <br>         ExpiresByType application/x-javascript A2592000 <br>         ExpiresByType application/javascript A2592000 <br>         ExpiresByType text/javascript A2592000 <br>         ExpiresByType text/html A600 <br>         </ifmodule> <br>          <br>         <ifmodule> <br>         <filesmatch> <br>         SetOutputFilter DEFLATE <br>         </filesmatch> <br>         </ifmodule> <br>          <br>         <ifmodule> <br>           mod_gzip_on Yes <br>           mod_gzip_dechunk Yes <br>           mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ <br>           mod_gzip_item_include handler ^cgi-script$ <br>           mod_gzip_item_include mime ^text/.* <br>           mod_gzip_item_include mime ^application/x-javascript.* <br>           mod_gzip_item_exclude mime ^image/.* <br>           mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* <br>         </ifmodule> <br>          <br>         <filesmatch> <br>         Header unset Last-Modified <br>         </filesmatch> <br>          <br>         FileETag none 赶快把它放到你的网站或blog根目录下的.htaccess文件里吧。

原文转载地址:http://www.jb100.net/html/content-22-738-1.html

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn