I am debugging a JavaScript problem and I am confused as to how the static files and versions work... I see the following in a stacktrace and can open this in a new tab:


but I know this file to actually be as listed but without version1577121673 (I know because I've directly edited it with a couple of console.log commands):


Where/how is it that the URL with version1577121673 is linked, mapped or otherwise to the actual file on the server?

3 Answers 3


It is an nginx/htaccess configuration.

For nginx it can be found in the nginx.conf.sample file at the root of your magento installation.(Or nginx.conf if you are already using nginx)

# Remove signature of the static files that is used to overcome the browser cache
    location ~ ^/static/version {
        rewrite ^/static/(version[^/]+/)?(.*)$ /static/$2 last;

For apache the code can be found in the pub/static/.htaccess file

# Remove signature of the static files that is used to overcome the browser cache
    RewriteRule ^version.+?/(.+)$ $1 [L]

As you can see, both directives remove the version from the uri to be able to get the good file. The point of doing this is to make sure when you deploy your static files the browser is going to reload the file since its path has changed and won't load one of its cached file.


You can find this version here. /var/www/html/magento_directory/pub/static/deployed_version.txt. It'll change every time while you run the command.


Take a look at Magento 2 devDocs for Static content signing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.