2009-10-21 59 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.