Magento 2 static resources missing after server change

After Migrating a Magento 2 site to a new server with a different folder structure (document root), static resources like CSS and JS files on the site stopped working. This error is because Magento uses symlinks, when you move the website to a new server with a different folder structure, these symlinks stop working.

To fix this, we need to regenerate static files.

First, make a copy of .htaccess file inside the static folder

Rename the static folder

Deploy the static resources

If you have multiple languages, specify the languages separated by space

Clear cache

Copy .htaccess file back to the “static” folder

Now static resources will work.

Back to Magento

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *