设置ExpiresActive时.htaccess 500内部服务器错误

Luk*_*uke 8 .htaccess

在我的.htaccess我有这个代码:

<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>
Run Code Online (Sandbox Code Playgroud)

它似乎在某些服务器上运行得很好,但在我的某个网站上却没有.我收到500内部服务器错误.配置中有什么问题,或者我是否需要联系我的主机?

Laz*_*One 32

确保启用并加载了这些Apache模块:

  • ExpiresActive - mod_expires
  • 标题 - mod_headers

试试这个(如果存在相应的模块,它只会使用指令):

<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>
Run Code Online (Sandbox Code Playgroud)