我的某个网站的服务器出现异常,我需要您的帮助才能找到解决方案。
如果我打开由FtpZilla下载的PHP文件并编辑任何PHP代码,一旦我保存并重新上传文件,新内容就会处于活动状态。
任何HTML代码都是一样的
如果在同一个文件中,我编辑了一些HTML代码,其中有一个标签,里面有javascript代码,当我上传新版本的文件时,JS代码被提供给浏览器是旧的。
我尝试使用CTRL + F5,几个浏览器:没有出路。
同样令人失望的结果,清理每个浏览器的缓存,因为"时间的开始"
重新打开刚刚上传的新文件,令人惊讶的是我发现了我的新代码。
就像服务器正在提供旧文件一样。
但为什么只有JS部分?
不仅:
我对任何JS外部文件都有同样的问题。我的意思是文件嵌入了标签到HTML页面
我尝试将任何缓存命令停用到.htaccess中,如下所示。但在这种情况下也没有更好的事情发生。
我还能做些什么呢?
# Requires mod_expires to be enabled.
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
#ExpiresDefault A1209600
# 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
#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"
修改
我刚注意到:
如果我创建一个指向原始JS文件的符号链接,当我通过符号链接读取文件时(因此在浏览器中我调用SymLink而不是文件):我仍然得到旧版本。甚至通过FileZilla打开它(编辑)。
就像指针永久指向旧版本一样。
如果我直接读取JS文件(直接调用它,甚至不通过嵌入式链接)我可以获得新版本
我迷路了。