正在提供index.php的旧版本

时间:2019-06-18 00:54:28

标签: php html apache .htaccess caching

更新我的一个客户站点后,加载页面时,缺少CSS。经过进一步的调查,我意识到我正在获取最新的CSS文件,但旧的index.php文件。

我尝试清除Chrome缓存,但这似乎并没有改变任何内容。刷新时会提供新版本,但我不希望我的客户客户必须硬刷新页面。我还尝试删除了htaccess的缓存部分,但仍然没有任何变化。

网站:https://thebossattorney.com

感谢您的帮助。

.htaccess代码


## Force SSL https ##
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
## End SSL https ##

## Remove trailing slash ##
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^(.*)/$ https://thebossattorney.com/$1 [R=301,L]
## End ##

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
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 text/html "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 1 month"
</IfModule>
## EXPIRES CACHING ##

## Remove page extension ##
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
## End page extension ##

## error pages ##
ErrorDocument 404 /index.php
## end error pages ##

## set time zone ##
SetEnv TZ America/Detroit
## end timezone ##

## Set webmaster email ##
ServerSignature EMail
SetEnv SERVER_ADMIN admin@server.com
AddDefaultCharset utf-8
## End ##

## Specify a Vary: Accept-Encoding header ##
<IfModule mod_headers.c>
  <FilesMatch ".(js|css|xml|gz|html)$">
    Header append Vary: Accept-Encoding
  </FilesMatch>
</IfModule>
## End ##


更新06/23/19:经过数小时的研究,我仍然没有找到解决方法。似乎只有index.php文件正在加载缓存的版本。无论我在第一次加载时清除浏览器缓存有多少次,我都会获得旧版本的index.php。但是,所有JS和CSS文件都加载正确的文件。我将暂时寻找一种使用Javascript在加载时重新加载页面的方法。病在这里更新。

1 个答案:

答案 0 :(得分:0)

头痛几小时后终于解决了这个问题。事实证明,Bluehost具有需要清除的服务器端缓存。在清除缓存后,服务器立即开始提供新版本的index.php

相关问题