Css Version Cache

Due to the caching codes we use on websites, there may be cases where the changes we make on the css cannot be displayed. To overcome this, we can make a new installation by changing the version information in the area where we call the css files.

The codes that cause this error;


ExpiresActive On
ExpiresDefault "access plus 2678400 seconds"
ExpiresByType text/html "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/xhtml+xml "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"

In these configuration codes, we ensure that the user who has entered the website before keeps the css file in its cache and prevents it from reloading using it for the next login.

This process causes the changes we make in the css files not to be viewed by users who have previously entered the site.

The css version process is a simple solution to view the last update of the change we made in the css file.

For this;

<link href="css/style.css?v1.1" rel="stylesheet">

The version information we wrote after the css file extension is enough to fix this problem.

If you wish, you can assign it to a variable via php and change the version from the admin panel.

<?php $version = "3.4.2"; ?>

<link rel="stylesheet" href="style.css?v=<?php echo $version; ?>">

 

 

The numbers you write after ?V for the version do not matter. You can write in history or any other issue that will make your job easier. The important thing is to enter a different number from previous versions.

E.Albayrak

0 Yorum

Soru & Yorum


Web Tasarım

Renkli Kare

Web Tasarım Ajansı