The main issue was caused by the incorrect rewrites work ( as @Marius told ). There was no RewriteBase
in my directory pub/static/
and Apache could not find the files because searched for them from the root folder. After we’ve added: RewriteBase /pub/static
everything start working.
How it worked:
by this address:
http://m2.uchuhlebov.web.ra/pub/static/version1481885888/frontend/Magento/luma/en_US/mage/requirejs/mixins.js
the rewrite should work:
RewriteRule ^version.+?/(.+)$ $1 [L]
as the line started from the root folder:
/pub/static/version...
it hasn’t worked and could not redirect to the file, needed.
Rewrite without base:
Rewrite with base:
Here a part of my .htaccess
file from the pub/static
(rewrites) :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /pub/static
# Remove signature of the static files that is used to overcome the browser cache
RewriteRule ^version.+?/(.+)$ $1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* ../static.php?resource=$0 [L]
</IfModule>
How to disable static-files versioning:
If you do not want to use static files versioning you can disable this feature in the Magento admin area:
It is possible to change this setting for default scope using the following MySQL query:
INSERT INTO `core_config_data`(`path`, `value`) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE `value`=0
Then execute next command to clear a configuration cache:
bin/magento cache:clean config
PS: My answer is actual for the apache2 users. If you are using NGINX see this answer (by @kevin-javitz)