简体   繁体   中英

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.

I am able to fix it in my .htaccess file with this code:

<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.

So I would like to know how to fix it on the server side, rather than using the .htaccess file. Would it be in the PHP variables? Or apache settings?

I called the webhost (godaddy) and the guy had no idea.

Thanks!

WordPress 5.6 added application passwords. It wants to add this to .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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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