- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的一个网站的服务器出现异常,我需要您的帮助来找到解决方案。
如果我打开 FtpZilla 下载的 PHP 文件并编辑任何 PHP 代码,一旦保存并重新上传该文件,新内容就会处于事件状态。对于任何 HTML 代码都是一样的
如果在同一个文件中我编辑一些 HTML 代码,其中有 <script></script>
标签和里面的javascript代码,当我上传新版本的文件时,JS代码提供给浏览器的是旧的。我尝试使用 CTRL+F5,几个浏览器:没有出路。同样令人失望的结果,自“时间开始”以来清理每个浏览器的缓存
重新打开刚刚新上传的文件,令人惊讶的是我发现了我的新代码。就像服务器正在提供旧文件一样。但为什么只有 JS 部分?
不仅:对于任何 JS 外部文件,我都遇到同样的问题。我的意思是这些文件嵌入了标签 <script src=""></script>
进入 HTML 页面
我尝试停用 .htaccess 中的任何缓存命令,如下所示。但在这种情况下也没有发生更好的事情。
请问我还能做什么?
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
#ExpiresDefault A1209600
<FilesMatch \.php$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off
</FilesMatch>
#ExpiresByType image/jpg "access 1 year"
#ExpiresByType image/jpeg "access 1 year"
#ExpiresByType image/gif "access 1 year"
#ExpiresByType image/png "access 1 year"
#ExpiresByType text/css "access 1 month"
#ExpiresByType application/pdf "access 1 month"
#ExpiresByType text/x-javascript "access 1 month"
#ExpiresByType application/x-shockwave-flash "access 1 month"
#ExpiresByType image/x-icon "access 1 year"
#ExpiresDefault "access 2 days"
</IfModule>
编辑:我刚刚注意到:如果我创建到原始 JS 文件的符号链接(symbolic link),当我通过符号链接(symbolic link)读取文件时(因此在浏览器中我调用 SymLink 而不是文件):我仍然得到旧版本。甚至可以通过 FileZilla 打开(编辑)它。就像指针永久指向旧版本一样。如果我直接读取 JS 文件(直接调用它,甚至不通过嵌入链接)我可以获得新版本我越来越迷失了。
最佳答案
ExpiresActive Off
实际上将使您的浏览器能够缓存内容,因为服务器没有设置缓存规则。如果你想禁用缓存你可以使用这样的东西:
<FilesMatch "\.(html)$">
Header set Cache-Control "private, no-cache, must-revalidate"
Header set Pragma "no-cache"
</FilesMatch>
这将告诉您的浏览器检查每个请求的新内容。如果内容不是动态创建的(例如,通过 php)并且文件自您上次收到以来没有被修改,apache 将发送一个没有数据的 304 Not Modified header (因为您的浏览器已经拥有最新版本)
关于javascript - 服务器正在缓存 JS 文件或嵌入 HTML 脚本吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32297878/
我有一个加号/减号按钮,希望用户不能选择超过 20 个但不知道如何让它工作。我尝试使用 min="1"max="5 属性,但它们不起作用。这是我的代码和一个 fiddle 链接。https://jsf
我正在尝试复制顶部底部图,如示例 here但它没有正确渲染(紫色系列有 +ve 和 -ve 值,绿色为负值)留下杂乱的人工制品。我也在努力创建一个玩具示例来复制这个问题,所以我希望尽管我缺乏数据,但有
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 已关闭 6 年前。 社区去年审查了是
这个问题在这里已经有了答案: Adding two positive integers gives negative answer.Why? (4 个答案) 关闭 5 年前。 我遇到了一个奇怪的问题
有谁知道如何将字符串值类型 -4,5 或 5,4 转换为 double -4.5 或 5.4? 最佳答案 只需使用 Double.parseDouble(Locale, String); 糟糕,我很困
我正在尝试根据 TextBlob 分类插入一个仅包含“正”或“负”字符串的新数据框列:对于我的 df 的第一行,结果是 ( pos , 0.75, 0.2499999999999997)我想要' 正
我对 VBA 非常陌生,无法理解如何在一个循环中完成 2 个任务。我非常感谢您的帮助。 我已经能够根据第 3 列中的数据更改第 2 列中的数值,但我不明白如何将负值的字体更改为红色。 表格的大小每月都
欢迎, 我正在使用 jquery 通过 POST 发送表单。 这就是我获得值(value)的方式。 var mytext = $("#textareaid").val(); var dataStrin
double d = 0; // random decimal value with it's integral part within the range of Int32 and always p
我有这个字符串: var a='abc123#xyz123'; 我想构建 2 个正则表达式替换函数: 1) 用 '*' 替换所有确实有 future '#'的字符(不包括'#') 所以结果应该是这样的
我正在使用 DialogFragment。当用户从 Gmail 平板电脑应用程序的屏幕与下面示例图片中的编辑文本进行交互时,我希望正面和负面按钮保持在键盘上方。 在我的尝试中不起作用,这是我的 Dia
从组装艺术一书中,我复制了这句话: In the two’s complement system, the H.O. bit of a number is a sign bit. If the H.O
是否有更好更优雅的方法来实现下面的简单代码(diffYear、A 和 B 是数字): diffYear = yearA - yearB; if (diffYear == 0) { A = B
我正在设计一种语言,并尝试确定 true 应该是 0x01 还是 0xFF。显然,所有非零值都将转换为 true,但我正在尝试确定确切的内部表示。 每种选择的优点和缺点是什么? 最佳答案 没关系,只要
在我的 dialogfragment 类的 OnCreateDialog 中,我正在这样做: AlertDialog.Builder builder = new AlertDialog.Builder
这个问题在这里已经有了答案: Resolving ambiguous overload on function pointer and std::function for a lambda usin
我偶然发现了一个奇怪的 NSDecimalNumber 行为:对于某些值,调用 integerValue、longValue、longLongValue 等,返回意想不到的值(value)。示例: l
这个问题在这里已经有了答案: Resolving ambiguous overload on function pointer and std::function for a lambda using
我有这个正则表达式来测试用户输入是否有效: value.length === 0 || value === '-' || (!isNaN(parseFloat(value)) && /^-?\d+\.
我想用高斯混合模型拟合数据集,数据集包含大约 120k 个样本,每个样本有大约 130 个维度。当我使用 matlab 执行此操作时,我运行脚本(簇号为 1000): gm = fitgmdist(d
我是一名优秀的程序员,十分优秀!