This depends on whether you want the server to cache the resources or not, this can be seen in one of the parameters of the requested server response headers, in the case of facebook is:
Cache-Control: "private, no-cache, no-store, must-revalidate"
This means don’t cache anything, it always renews, and it’s private (in case you have something cached, it’s just for me). Here and here are these paramenters best explained.
To set up your server cache in php you can do:
header("Cache-Control: private, no-cache, must-revalidate");
Or in html you can also exs:
<meta http-equiv="Cache-control" content="public">
<meta http-equiv="Cache-control" content="private">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache-control" content="no-store">
Or htaccess ex:
<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
Header set Cache-Control "max-age=2628000, public"
</filesMatch>
In this case, this htaccess serveria for your case caches the resources with these extensions. But note that this could be set in php as well
An aspect not directly related to the question, but it has to do with performance, it is also important to do gzip resources, can in the .htaccess
do:
<IfModule mod_deflate.c>
<FilesMatch "\.(html|php|txt|xml|js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
To answer your question, you can control it on the server and configure it with your preferences, here another reference.
hum, so it’s possible to cache JS and CSS, good. You could show me how to make the system store JS and CSS in public cache and PNG I don’t want to save. I wanted to do this via htaccess.
– Hugo Borges
You have the example for this in the reply, I edited htaccess @Hugoborges
– Miguel
OK thank you very much
– Hugo Borges
@Hugoborges, an alert... If you’re working on the site and you don’t see anything change that’s why, because of this cache
– Miguel