2009-10-21 56 views
5

我正在尝试设置过期特定URI头,但由于某种原因,它不工作,我已经在httpd.conf文件中迄今所做的是以下几点:设置特定URI的过期标题?

<LocationMatch "/mysite/contentservices/weather/get.json"> 
    ExpiresDefault A86400 
</LocationMatch> 

<LocationMatch "/mysite/*"> 
    Options FollowSymLinks MultiViews 
    AllowOverride All 
    Order allow,deny 
    Allow from all 
    ExpiresByType text/css "access plus 1 day" 
    ExpiresByType text/javascript "access plus 1 day" 
    ExpiresByType image/gif "access plus 1 week" 
    ExpiresByType image/jpg "access plus 1 week" 
    ExpiresByType image/png "access plus 1 week" 
    ExpiresByType application/x-shockwave-flash "access plus 1 week" 
</LocationMatch> 

这只是做不适合我。我没有为我指定的内容使用过期日期标题。我也不明白当你有两个LocationMatch指令重叠,第一个优先?

回答

0

尝试切换LocationMatch方括号。

或者:某些代理服务器删除过期标题。

+0

能否请你给我一个例子吗? – 2009-10-21 15:55:26

+0

是否意味着他应该把get.json放在/ mysite/*之后? – 2009-10-22 08:23:04

1

我认为/mysite/contentservices/weather/get.json是一个静态数据文件,而不是由CGI/mod_php /其他东西提供?

configs按配置文件中的顺序应用。

http://httpd.apache.org/docs/2.0/sections.html

虽然没有给出其它因素的说法不同的格式不应该是一个问题,如果你尝试它可能是值得检查会发生什么:

<LocationMatch "/mysite/contentservices/weather/get.json"> 
    ExpiresDefault "access plus 1 day" 
</LocationMatch> 

C.