nginx automatically adds version numbers to static resource files

nginx automatically adds version numbers to static resource files

To automatically append version numbers to JS and CSS files, add the following code to the nginx site configuration file:

location ~ \.(js|css)$ {
        root   /XXXXXXXX;
if ($request_uri !~ 123){
rewrite ^(.*)$ $1?v=123 permanent;
}

}

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *