的.htaccess时设置500内部服务器错误ExpiresActive [英] .htaccess 500 internal server error when set ExpiresActive

查看:368
本文介绍了的.htaccess时设置500内部服务器错误ExpiresActive的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的的.htaccess 我有这个code:

In my .htaccess I have this code:

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|txt|html|x-html|php|css|xml|js|woff|ttf|svg|eot)(\.gz)?$">
ExpiresActive On
Header set Expires "Sun, 27 May 2012 00:00:00 GMT"
Header unset ETag
FileETag None
</FilesMatch>

这似乎在一些服务器上完美工作,但不是我的网站之一。我得到一个500内部服务器错误。 有什么错误的配置,或者我需要联系我的主人?

It seems to work perfectly on some servers, but not on one of my websites. I get a 500 Internal Server Error. Is there anything wrong in the config, or do I have to contact my host?

推荐答案

请确保您已启用这些Apache模块和加载:

Ensure that you have these Apache modules enabled and loaded:

  • ExpiresActive - mod_expires
  • 标题 - mod_headers中

试试这个,而不是(它只会使用指令,如果相应的模块为present):

Try this instead (it will only use directives if corresponding module is present):

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|txt|html|x-html|php|css|xml|js|woff|ttf|svg|eot)(\.gz)?$">
    <IfModule mod_expires.c>
        ExpiresActive On
    </IfModule>
    <IfModule mod_headers.c>
        Header set Expires "Sun, 27 May 2012 00:00:00 GMT"
        Header unset ETag
    </IfModule>
    FileETag None
</FilesMatch>

这篇关于的.htaccess时设置500内部服务器错误ExpiresActive的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆