【问题标题】:still getting Expires: Thu, 19 Nov 1981 08:52:00 GMT even after setting即使在设置之后,仍然会过期:1981 年 11 月 19 日星期四 08:52:00 GMT
【发布时间】:2019-06-24 10:29:05
【问题描述】:

我的 htaccess 文件是

<IfModule mod_headers.c>
   Header set X-XSS-Protection "1; mode=block"
   Header always append X-Frame-Options SAMEORIGIN
   <FilesMatch ".(jpg|jpeg|png|gif|swf|js|css)$">
      Header set Cache-Control "max-age=5184000, public"
   </FilesMatch>
</IfModule>
<IfModule mod_expires.c>
   ExpiresActive On
   ExpiresByType image/jpg "access plus 1 month"
   ExpiresByType image/jpeg "access plus 1 month"
   ExpiresByType image/gif "access plus 1 month"
   ExpiresByType image/png "access plus 1 month"
   ExpiresByType image/ico "access plus 1 month"
   # Webfonts
   ExpiresByType application/x-font-ttf "access plus 1 month"
   ExpiresByType font/opentype "access plus 1 month"
   ExpiresByType application/x-font-woff "access plus 1 month"
   ExpiresByType image/svg+xml "access plus 1 month"
   ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
</IfModule>

我尝试做ExpiresActive Off 我也评论了这个模块的每一行,事件我完全删除了它。我也在FilesMatch 节点中尝试Header set Expires "0"。但我无法删除过期。我想过期显示日期的 +1 天。我如何做到这一点?

【问题讨论】:

    标签: php .htaccess http-headers


    【解决方案1】:

    首先检查 .htaccess 是否被读取。在第一行放置一些乱码,然后服务器应该以 500 错误响应。如果没有错误,请联系您的服务器管理员,他禁用了 htaccess 处理。

    另请注意,htaccess 仅对它所在的目录及其所有子目录有效。

    (顺便说一句,您不需要 IfModule 语句。使用 htaccess 时,您应该知道哪些模块处于活动状态。IfModule 是针对第三方软件包和非常通用的服务器配置任务。)

    【讨论】:

      猜你喜欢
      • 2012-02-13
      • 1970-01-01
      • 2016-12-16
      • 1970-01-01
      • 1970-01-01
      • 2011-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多