English 中文(简体)
ache: ExpiresDefault don t work, 而“Header”确实如此。 如何?
原标题:Apache: ExpiresDefault doesn t work, whereas "Header" does. How comes?

如果我这样做的话:

<IfModule mod_expires.c>
  <FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4|css|js|php)$">
    ExpiresActive On
    ExpiresDefault "access plus 30 days"
  </FilesMatch>
</IfModule>

It doesn t set properly the Expire header, whereas if I "force" it by hand like this:

<IfModule mod_expires.c>
  <FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4|css|js|php)$">
    ExpiresActive On
    Header set Expires "Thu, 18 Jan 2012 20:00:00 GMT"
  </FilesMatch>
</IfModule>

It works. This implies 2 things:

  • mod_expire is installed (IfModule mod_expires.c is true)
  • the Expire header is not modified after this rule is applied.

我失踪了什么?

顺便说一句:如果你能找到任何解决办法,让我工作!

最佳回答

Ok I ve got it from the official documentation here:

Note that if you use a modification date based setting, the Expires header will not be added to content that does not come from a file on disk. This is due to the fact that there is no modification time for such content.

So it works only for static files, and not for all the other ones: they re not static.

问题回答

而我也感到迷惑不解,因为AFAIK应该这样工作,我就在考试和测验中尝试过考试,时间不一,时间不一。 对我的工作罚款。 我的阿帕奇版本

Server version: Apache/2.2.14 (Ubuntu)
Server built:   Nov 18 2010 21:17:19

Any the headers for a test file (using chrome developer tools) (with N=15) show:

Date:Mon, 09 Jan 2012 01:48:43 GMT
ETag:"7574-5-4b60e88a820a1"
Expires:Tue, 24 Jan 2012 01:48:43 GMT

我认为,任何<代码>ExpiresDefault均可被否决。 Header set Expires . 否 等级等级,以确保<代码>ExpiresDefault在较低级别被压倒。

If you don t want htaccess files doing this you need to disable them in your http config.





相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...

热门标签