What is the static content signing?

Adding a digital signature to the URL of static files makes it possible for browsers to detect when a newer version of the file is available.
Static files that can be tracked with digital signatures include JavaScript, CSS, images, and fonts.
The signature is appended to the path directly after the base URL.
If a file’s signature differs from what is currently stored in the browser’s cache, then the newer version of the file is used.


How to enable or disable the static content signing mode?

Static content cache

To improve performance, Magento sets the Expires headers for static resources such as images, JavaScript, and CSS files.
Setting the Expires header on a static resource tells the browser to cache the resource at that URL and serve the cached version until it expires.
This is a common best practice for caching static resources.

When the browser caches a static resource and that resource changes on the server, you need to clear the browser cache so it can download the new version.
Manually clearing the browser cache works if you are a website administrator, but this is not an appropriate request to make of your users when you want them to download new versions of a static resource.

Static content signing

Static content signing is a Magento feature that allows you to invalidate the browser cache for static resources.
Magento accomplishes this by adding a deployment version to the URL of static files.

The following is an example of a URL signed with a version:


When you run the command setup:static-content:deploy to deploy static content, Magento automatically changes the deployment version.
This changes the URL of the static files and forces the browser to load the new version of the files.

Magento enables this feature by default, and we recommend keeping this feature enabled to prevent issues related to browsers serving up old static resources.

You can find the configuration for this feature in Stores > System > Configuration > Advanced > Developer > Static Files Settings.

Version signatures

Magento appends the version signature as a path component directly after the base URL of static view files to preserve the integrity of relative URLs across static resources.
This also forces the browser to resolve a relative URL to the correct signed source while keeping its content independent of the presence/absence of the signature value.

When a browser requests a signed source from the server, the server uses URL rewrites to strip the signature component from the URL.

Usage during deployments

After upgrading or modifying static resources, you need to run the setup:static-content:deploy command to deploy the version and update the static contents.
This forces the browser to load the updated resources.

If you deploy code on a separate server and move it to production using a code repository to reduce downtime, you also need to add the file pub/static/deployed_version.txt to the repository.
This file contains the new version for the deployed static content.

When we enable version signatures features then it’s creating SEO 404 issues for js/css files when we rung setup:static-content:deploy commands because it’s changed version number. How can we stop these files to count in SEO reports? I have added Disallow: /pub/static/
in robots.txt file.

Please let me know