Ali
Ali

Reputation: 10453

Add expire header to improve the performance of page using .htaccess

I have a great .htaccess code which really improve my page speed.

This one below I below I don't really know much but from looking at it is like to compress or something not really sure

<FilesMatch ".(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>

This one is really great which set the Expire header for everything to 10 years and text/html to one day

ExpiresActive On
ExpiresDefault "access plus 10 years"
ExpiresByType text/html "access plus 1 day"

So This one is use to unset ETag which is one of the requirement rules of YSlow

Header unset ETag
FileETag None

Now come to my question that I have problem with.

I can't really use w3 Total cache with my Wordpress blog because it gives me some random issue like only show one ramdom old post to my home page and to solve that is to delete the cache and then after a day it will happen again.

So I can't rely on that plugin, but with my 3 codes that I added in my .htaccess is really good with one exception and I don't know really how to fix that.

say for example I visit my site http://applesiam.com this morning and during the day I have 3 new posts. If I don't really do hard reload page I will still see the one from morning.

So this is really make me confuse.

What should I change to not to cache the actual home page so it will be updated except images and the rest.

Upvotes: 1

Views: 2614

Answers (1)

Ali
Ali

Reputation: 10453

I'm not sure if this is going to work but I found this which is going to solve the behaviour of the browser cache the file that update dynamically

# Force no caching for dynamic files
<filesMatch "\.(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</filesMatch>

Upvotes: 1

Related Questions