【问题标题】:getting error 500 when trying to use gzip with .htaccess尝试将 gzip 与 .htaccess 一起使用时出现错误 500
【发布时间】:2011-01-11 18:44:54
【问题描述】:

我正在尝试在我的网站上使用 gzip。

我正在尝试压缩 php、css 和 js 文件。服务器是apache 1.3,我在.htaccess文件中的代码是:

# compress all text & html:
AddOutputFilterByType DEFLATE text/html text/plain text/xml

但是当我上传这个时,我只是得到一个错误 500 页面。

任何想法。

【问题讨论】:

  • 您的 Apache 错误日志说明了什么?那里可能有更多细节......
  • 使用以下内容似乎根本没有任何效果:<IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|css|js|php|pl|jpg|png|gif)$ 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>

标签: .htaccess gzip


【解决方案1】:

试试这个

<Files *>
    #Compress
    SetOutputFilter GZIP
</Files>

或者这个

<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>

【讨论】:

    【解决方案2】:

    AddOutputFilterByType 在 Apache 1.3 (src) 上似乎不可用。我相信您需要改用mod_gzip

    “兼容性:在 Apache 2.0.33 及更高版本中可用;在 Apache 2.1 及更高版本中已弃用”

    【讨论】:

      猜你喜欢
      • 2011-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-09
      • 1970-01-01
      • 2012-03-06
      • 1970-01-01
      相关资源
      最近更新 更多