htaccess缓存和php缓存太多了

htaccess缓存和php缓存太多了

问题描述:

Ok, I have a little problem. I think my .htaccess caching is causing problems. I have intergrated a nice PHP Cache system on each page.

I also have included this in my .htaccess page:

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##

I have a CMS installed ( not wordpress ) - and when I submit or edit a new story to the MYSQL database through my CMS, I have it clear the "cached pages".

That all works great.

However, when I go to the site after the cache has been cleared, I still need to do a hard browser refresh to see the updated and new content.

Do I get rid of the .htaccess cache code ? or what ?

Thanks for your tips.

You'll want to remove the line

ExpiresDefault "access plus 2 days"

It forces a browser to cache anything not explicitly listed above (like, for instance text/html) for two days, which is what is happening to your Wordpress posts.