首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何为Magento 1.7.0.2启用GZIP

问如何为Magento 1.7.0.2启用GZIP
EN

Stack Overflow用户
提问于 2013-09-10 10:17:35
回答 1查看 8.9K关注 0票数 0

我想通过启用GZIP来加速我的Magento商店。

使用.htaccess的任何解决方案都是可能的?

怎么做?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-09-10 10:24:50

使用gzip和浏览器缓存来加速您的站点,然后在Google快速洞察力中测试它:http://developers.google.com/speed/pagespeed/insights/

代码语言:javascript
复制
     <IfModule mod_headers.c>
# YEAR
<FilesMatch "\.(ico|gif|jpg|jpeg|png|flv|pdf)$">
Header set Cache-Control "max-age=29030400"
</FilesMatch>
# WEEK
<FilesMatch "\.(js|css|swf)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
# 45 MIN
<FilesMatch "\.(html|htm|txt)$">
Header set Cache-Control "max-age=86400"
</FilesMatch>
</IfModule>

<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file \.(html?|txt|css|js|php|pl|asp|html)$
  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.*
</ifModule>

<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
票数 11
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18716248

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档