I
I
ibesenok2016-05-09 14:37:06
PHP
ibesenok, 2016-05-09 14:37:06

How to clear the cache on the site?

The client has a WordPress site. There are no caching plugins. But when the page is refreshed, then the desired picture (which is loaded on the server) flies out, then its previous copy (Which does not exist on the server). The path to them is the same.
Similarly, when you load styles, they are not updated. Although this is not the case with php files.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ivan Vorobei, 2016-05-09
@ivanvorobei

Cached on the hosting side.
For CSS add to .htaccess

<FilesMatch ".(css)$">
    Header append Cache-Control "no-store, no-cache, must-revalidate"
</FilesMatch>

P
Pavel Gogolinsky, 2016-05-09
@gogolinsky

Try watching with a different browser. If everything is in order in it (I think it will be), then clear the browser cache through its settings

D
Denis Ineshin, 2016-05-09
@IonDen

The cache is always a problem, so advanced developers have long learned to force it to be demolished using the file version. Each new build changes the version, for example from 1 to 2. Next, add the version to the static resource path, something like this:

<img src="image.png?v=2" alt="" />
<!-- или генерируем имена файлов с учетом версии -->
<img src="image_v2.png" alt="" />

Well, then, every time we update and build the project, we increase the number (very often, instead of a simple number, a randomly generated hash or the current date in seconds (unix-time) is used.
Look, for example, in the toaster source, you will see that here, in the names of static files, the hash is added:
<link rel="stylesheet" href="https://habracdn.net/toster/frontend.47dba5ea-12bc-11e6-81cb-38eaa71001f0.css">

I
inDeepCode, 2016-05-10
@inDeepCode

The problem may be in the loadbalancer/varnish.
As an example: the content is stored on different servers and, accordingly, it is loaded from one (where it has already been updated), then from another (where not yet).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question