Mobile app version of vmapp.org
Login or Join
Chiappetta492

: Did I just stop my caching issue? I frequently upload my projects on my hosting and ask some feedback; but the problem is that those people always have to clean their cache in order to see

@Chiappetta492

Posted in: #Cache #Cpanel #Ftp #WebHosting

I frequently upload my projects on my hosting and ask some feedback; but the problem is that those people always have to clean their cache in order to see the new changes. So I think i might just fixed my issue; with the following code, but I'm not sure, and I'm not a wizard at the whole ftp editing etc.

I've posted here before, and a user gave me some help.

So heres what I did, I went into my cpanel and located to my public_html and checked for any hidden files, I couldn't find a .htaccess file so I made one myself and copy pasted these lines and saved it.

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 60 seconds"
ExpiresByType text/html "access plus 60 seconds"
ExpiresByType image/x-icon "access plus 60 seconds"
ExpiresByType image/gif "access plus 60 seconds"
ExpiresByType image/jpeg "access plus 60 seconds"
ExpiresByType image/png "access plus 60 seconds"
ExpiresByType text/css "access plus 60 seconds"
ExpiresByType text/javascript "access plus 60 seconds"
ExpiresByType application/x-javascript "access plus 60 seconds"
</IfModule>


Everyone who visits my site now should redownload all the files right? And it won't cache anymore?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Chiappetta492

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

Yes, this will cause clients to re-download when the asset has expired a minute later. This runs under the assumption you've switched e-tags off (see below).

The downside is people are now burning up more bandwidth on your site and your page speed will tank. This will at worst cost you more and at best still cause a poor user experience. If someone spends 2 mins on a page, then goes to the next, they're having to re-download all the CSS and JS files common to both again.

I'm assuming that since you're implementing expiry times and clients aren't refreshing content, that you've switched e-tags off in Apache (enabled by default in most versions now). I would recommend switching on e-tags and making sure they're configured properly to prompt a client to refresh the asset when it's changed.

An e-tag 'inquiry' from the client should reveal that the file has changed and prompt a download. Expiry times would override this by asking the client not to make this query. Be careful that you're not contradicting yourself with these two check methods.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme