After upgrade from the Magento 2.1.0 to the Magento 2.1.3 (using composer) static content is not loading anymore. In the browser console I can see that all files is unavailable (404):
I don't see directories with the name version*
in the pub
directory.
What I already made but it didn't help:
- set all permissions to
777
, but without success. - cleaned cache
- removed the
pub/static/*
- regenerated static content few times
- replaced the
.htaccess
file (in thepub/static
directory) with the file from an official repository.
Another info:
mod_rewrite
is enabledFollowSymLinks
is allowed (in the default host configuration and local.htaccess
)- This configuration worked fine with Magento 2.1.0 before the updating to the 2.1.3
pub/static
is writable
Any suggestions?
Best Answer
The main issue was caused by the incorrect rewrites work ( as @Marius told ). There was no
RewriteBase
in my directorypub/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:
the rewrite should work:
as the line started from the root folder:
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 thepub/static
(rewrites) :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:
Then execute next command to clear a configuration cache:
PS: My answer is actual for the apache2 users. If you are using NGINX see this answer (by @kevin-javitz)