且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

htaccess Expires标头中的更改未反映在浏览器中

更新时间:2023-02-12 09:58:13

我的第一个倾向是,您需要能够在目录目标块内使用'AllowOverride'来实现特定文件的覆盖。

My first inclination is that you need to be able to use the 'AllowOverride' within a Directory target block to achieve the override of a specific file.

<Directory "/directory/to/your/file">
    AllowOverride All
    <FilesMatch "\.js$">
        Expires A31536000
    </FilesMatch>
</Directory>

来源:
http://www.websiteoptimization.com/secrets/advanced/caching-example.html

我强烈建议您在排除任何内容之前关闭CloudFlare进行测试。

I highly recommend turning off CloudFlare to do the testing of this before you rule anything out.

检查出回答此问题: https://webmasters.stackexchange.com/questions/9513/htaccess -执行顺序和优先级

我添加这个是因为我认为这也可能是一个订购问题。 .htaccess从根开始,并遍历目录。

I am adding this because I think that it is also possible that this is an ordering issue. .htaccess starts at the root and works its way through the directories.