【发布时间】:2014-08-04 16:15:37
【问题描述】:
我想加快我的网站速度。我在http://www.webpagetest.org/ 网站上进行了测试,检查网站的性能和优化。
我在 .htaccess 文件中启用了 Keep-Alive。问题是测试结果表明只有 18% 的连接是允许的(那些通过 google 链接或包含的连接)
截图:
有人可以向我解释如何允许所有连接吗?
我使用的代码:
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year”
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access 1 month”
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
<IFModule mod_deflate.c>
<filesmatch "\.(js|css|html|jpg|png|php)$">
SetOutputFilter DEFLATE
</filesmatch>
</IFModule>
<IfModule mod_headers.c>
Header set Connection keep-alive
</IfModule>
【问题讨论】:
标签: apache .htaccess keep-alive