Magento 2 – Fix Static Content for Languages Not Generated After Migration

cssdeploymagento2migration

I made a backup of Magento 2 and copied the whole site to another host. I extracted files and created a database. Now I get no CSS loaded. They all are "missing".

First I thought that it was caching or rewrite module problem, but now I found that if I deploy the static content, only en_US is deployed, although my default is ru_RU (this is where the CSS files are attempted to be loaded from).

Best Answer

The main command it's below that will deploy the en_US and ru_RU:

php -f bin/magento setup:static-content:deploy en_US ru_RU

If doesn't work run these commands:

alias mage="php -d memory_limit=-1 -f bin/magento"

chmod -R 775 pub/static/ var/ pub/media/ &&
rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/ ;
php -r "opcache_reset();"
mage deploy:mode:set developer;
mage setup:static-content:deploy en_US ru_RU;
mage cache:flush &
mage indexer:reindex &
mage setup:upgrade &&
mage setup:db-data:upgrade &&
mage dev:source-theme:deploy &&
chmod -R 775 pub/static/ pub/media/ var/