【发布时间】:2014-07-13 14:15:43
【问题描述】:
所以我的一些 PHP 文件中有这些标头:
<?php
header('Content-Type: text/html; charset=UTF-8');
header('Content-Style-Type: text/css');
header('Content-Script-Type: application/javascript');
header('HTTP/1.1 200 OK');
header('Content-language: en-US');
header('X-Powered-By: PHP/5.2.17');
header('Last-Modified: Tue, 01 Jan 2013 00:00:00 GMT');
header('Cache-Control: no-store, no-cache, max-age=0, must-revalidate');
header('Pragma: no-store, no-cache, max-age=0, must-revalidate');
header('Expires: Tue, 01 Jan 2013 00:00:00 GMT');
?>
如何在我的 .htaccess 文件中设置它们? (应该只针对特定文件),这是我目前得到的:
<FilesMatch "^(index.php|about.php|contact.php)$">
# HTTP Headers should be set in here
</FilesMatch>
【问题讨论】:
-
可以在 .htaccess 中定义过期和缓存等内容,但 HTTP 200 等内容不应该。为什么要这样做?
-
指令的名字叫Header ;-P
标签: php .htaccess http-headers