mod_deflate 不适用于所有子目录
mod_deflate not working on all subdirectories
我正在尝试优化站点以提高速度,我已使用以下代码段在 htaccess 文件中启用 mod_deflate。
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/css
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
但是当我 运行 通过 gtmetrix 进行速度测试时,它告诉我一些文件还没有压缩。
http://example.com/themes/default/assets/js/jquery.themepunch.tools.min.js
http://example.com/themes/default/assets/js/jquery.js
http://example.com/themes/default/assets/js/jquery.themepunch.revolution.min.js
http://example.com/assets/js/bootstrap.min.js
http://example.com/assets/plugins/bootstrap-select/js/bootstrap-select.min.js
http://example.com/assets/plugins/bx-slider/jquery.bxslider.min.js
http://example.com/assets/plugins/bootstrap-touchspin/js/jquery.bootstrap-touchspin.min.js
http://example.com/assets/plugins/bootstrap-touchspin/css/jquery.bootstrap-touchspin.min.css
http://example.com/themes/default/assets/css/custom-2.css
mod_deflate我不是很懂。上面说 application
的部分是一个文件夹吗?我是否应该添加一个新的部分深入到子文件夹中。这样做似乎文件会变得相当大
这直接证明是我服务器的问题。因为我的服务器使用的是nginx,所以所有的缓存命令都需要在nginx配置文件里面设置。
我正在尝试优化站点以提高速度,我已使用以下代码段在 htaccess 文件中启用 mod_deflate。
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/css
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
但是当我 运行 通过 gtmetrix 进行速度测试时,它告诉我一些文件还没有压缩。
http://example.com/themes/default/assets/js/jquery.themepunch.tools.min.js
http://example.com/themes/default/assets/js/jquery.js
http://example.com/themes/default/assets/js/jquery.themepunch.revolution.min.js
http://example.com/assets/js/bootstrap.min.js
http://example.com/assets/plugins/bootstrap-select/js/bootstrap-select.min.js
http://example.com/assets/plugins/bx-slider/jquery.bxslider.min.js
http://example.com/assets/plugins/bootstrap-touchspin/js/jquery.bootstrap-touchspin.min.js
http://example.com/assets/plugins/bootstrap-touchspin/css/jquery.bootstrap-touchspin.min.css
http://example.com/themes/default/assets/css/custom-2.css
mod_deflate我不是很懂。上面说 application
的部分是一个文件夹吗?我是否应该添加一个新的部分深入到子文件夹中。这样做似乎文件会变得相当大
这直接证明是我服务器的问题。因为我的服务器使用的是nginx,所以所有的缓存命令都需要在nginx配置文件里面设置。