Magento2 calling assets in folder pub/static/versionXXXXXXX after static content deploy
-
11-12-2020 - |
Question
I'm running the command php bin/magento setup:static-content:deploy
which exports all the assets in pub/static
(creates folders: _requirejs, adminhtml and frontend), changes the deployed version in deployed_version.txt
, and finishes with 0 errors.
The problem is that my frontend is calling assets like:
$BASE_URL/pub/static/**version$DEPLOYED_VERSION**/frontend/... (e.g. http://local.estores.com/pub/static/version1503583668/frontend/Magento/luma/en_US/mage/calendar.css)
instead of:
$BASE_URL/pub/static/frontend/... (without the version folder).
Not sure why it's doing this, or how to change it. I upgraded and recompiled. The deploy process is creating the files, so I guess it's not a permissions thing.
Solution
It is an magento2 feature.
magento2 used to overcome the browser cache for Static content.
There will be file at pub/static/.htaccess which internally rewrite all
BASE_URL/pub/static/**version$DEPLOYED_VERSION**/frontend/
to
BASE_URL/pub/static/frontend/.
In your case, you have an issue with rewrite
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange