Sta*_*bie 7 .htaccess mod-expires response-headers expires-header
我的PHP代码:
$expires_date = date('D, j F Y H:i:s', strtotime('now + 10 years')) . ' GMT';
header("Expires: $expires_date");
header('Content-type: text/javascript');
echo 'hello world';
Run Code Online (Sandbox Code Playgroud)
当我检查响应头时,我看到:
Expires:Thu, 01 Jan 1970 00:00:00 GMT
我究竟做错了什么?
更新:
只是在尝试,但似乎我甚至无法取消Expires via header_remove('Expires');
.我仍然看到1970年的约会.
更新:
我的回复标题:
Cache-Control:private
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:74
Content-Type:text/javascript
Date:Wed, 17 Oct 2012 22:40:45 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Keep-Alive:timeout=5, max=98
Server:Apache/2.2.21 (Win32) PHP/5.3.9
Vary:Accept-Encoding
X-Powered-By:PHP/5.3.9
Run Code Online (Sandbox Code Playgroud)
看看你的htaccess文件:
<FilesMatch "\.(htm|html|php)$">
Header set Expires "Thu, 01 Jan 1970 00:00:00 GMT"
# TODO: Google.com's setting are the following
# Expires -1
# Cache-Control private, max-age=0
</FilesMatch>
Run Code Online (Sandbox Code Playgroud)
它看起来像是FilesMatch .php
覆盖.htaccess Content-Type:text/javascript
规则和PHP过期标头,因为脚本是一个.php文件.
注释掉这个标题会在.htaccess中过期,看看PHP标题+ 10年到期是否仍然给出了1/1/1970的日期
归档时间: |
|
查看次数: |
2875 次 |
最近记录: |