PHP Apache:
function cssInclude($file) {
$fileMTime = filemtime($_SERVER['DOCUMENT_ROOT']."/media/css/".$file.".css");
return "<link rel=\"stylesheet\" href=\"/media/css/{$file}.{$fileMTime}.css\"
}
<head>:
<?= cssInclude("style"); ?>
.htaccess:
RewriteEngine on
RewriteRule ^media/(js|css|img|font)/(.+)\.(\d+)\.(js|css|png|jpg|gif)$ /media/$1/$2.$4 [L]
, , . CSS ?, style.css?12313123, , , , , (, ).
style.123123123.css, , , , .
, .htaccess - .
Of course, this means that you are reading material from the file system, but if you have a caching layer, this is done only once for the update.
source
share