针对windows版本的apache2.2,开启方法如下:
第一步:
找到apache的配置文件httpd.conf,找到下面两行,将前面的 # 去掉.
1
2
|
LoadModule deflate_module modules/mod_deflate.so LoadModule expires_module modules/mod_expires.so |
重启apache服务器.
第二步:
打开网站的 .htaccess 文件,将下面代码拷贝进去:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
< IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 12 month" ExpiresByType text/html "access plus 12 months" ExpiresByType text/css "access plus 12 months" ExpiresByType image/gif "access plus 12 months" ExpiresByType image/jpeg "access plus 12 months" ExpiresByType image/jpg "access plus 12 months" ExpiresByType image/png "access plus 12 months" EXpiresByType application/x-shockwave-flash "access plus 12 months" EXpiresByType application/x-javascript "access plus 12 months" ExpiresByType video/x-flv "access plus 12 months" </ IfModule > < IfModule mod_deflate.c> SetOutputFilter DEFLATE AddOutputFilterByType DEFLATE text/html text/css image/gif image/jpeg image/png application/x-javascript </ IfModule > |