简体   繁体   English

什么会导致缓存服务器变量?

[英]What would cause the caching of server variables?

I am having issues with server variables (like the page URL) being cached so that when you go to a new page, the variable that contains the server URL doesn't actually change.我在缓存服务器变量(如页面 URL)时遇到问题,因此当您转到新页面时,包含服务器 URL 的变量实际上不会更改。

I am able to fix it in my .htaccess file with this code:我可以使用以下代码在我的 .htaccess 文件中修复它:

<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>

<FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|swf|txt)$">
    <IfModule mod_expires.c>
        ExpiresActive Off
    </IfModule>
    <IfModule mod_headers.c>
        FileETag None
        Header unset ETag
        Header unset Pragma
        Header unset Cache-Control
        Header unset Last-Modified
        Header set Pragma "no-cache"
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
    </IfModule>
</FilesMatch>

So, I know the fix, but I need to know what is causing it because it's a WordPress site (and no, it's not being caused by plugins, I tested with a fresh WP install) and therefore my .htaccess file gets periodically overwritten by WordPress.所以,我知道修复程序,但我需要知道是什么导致它,因为它是一个 WordPress 站点(不,它不是由插件引起的,我使用全新的 WP 安装进行了测试),因此我的 .htaccess 文件会定期被覆盖WordPress。

So I would like to know how to fix it on the server side, rather than using the .htaccess file.所以我想知道如何在服务器端修复它,而不是使用 .htaccess 文件。 Would it be in the PHP variables?它会在PHP变量中吗? Or apache settings?还是apache设置?

I called the webhost (godaddy) and the guy had no idea.我打电话给网络主机(godaddy),这家伙不知道。

Thanks!谢谢!

WordPress 5.6 added application passwords. WordPress 5.6 添加了应用程序密码。 It wants to add this to .htaccess: RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]它想将此添加到 .htaccess: RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

I would try:我会尝试:

  1. chmod 600 .htaccess

  2. add_filter('wp_is_application_passwords_available', '__return_false');

Best wishes, Mitchell最好的祝福,米切尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM