On Setting Magento 2 Store with version 2.4.2 my front-end is messy like enter image description here.

i have removed my var cache folders and pub->static folders and run

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

and then clear cache and given permission but the issue is still there i have checked the .htaccess file it will be there in pub->static

When i check the console it will load the path http://mag24.local/static/version1620651126/adminhtml/Magento/backend/en_US/requirejs/require.js without pub before the static so it will become messy i think.

Any idea whats the issue and how to solve this ?

  • You Should not remove the pub > static folder fully there will .htaccess file it should not be deleted. Please push .htaccess file if you have any backup. Then run the below commands.php bin/magento setup:upgrade php bin/magento setup:static-content:deploy -f php bin/magento setup:di:compile php bin/magento cache:clean php bin/magento cache:flush
    – Sabareesh
    May 10, 2021 at 13:45

4 Answers 4


You can use these commands to thoroughly upgrade compile and deploy your code.


php bin/magento setup:upgrade


php bin/magento setup:di:compile


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

Cache Clear

php bin/magento cache:clean or cache:flush

Grant Permission

chmod 777 -R var/* pub/* generated/*

You can run a combined command for everything.

sudo php bin/magento setup:upgrade && 
sudo php bin/magento setup:di:compile && 
sudo php bin/magento setup:static-content:deploy -f && 
sudo chown 777 -R var/* pub/* generated/* && 
sudo php bin/magento c:f && 
sudo chown -R $USER:www-data ../mag24/

Try turning off Sign Static Files under Stores -> Configuration -> Advanced -> Developer -> Static File Settings.

Also run this

rm -rf var/di/* ;
rm -rf var/generation/* ;
rm -rf var/cache/* ;
rm -rf var/log/* ;
rm -rf var/page_cache/* ;
rm -rf var/session/* ;
rm -rf var/view_preprocessed/* ;
rm -rf pub/static/frontend/*;
rm -rf pub/static/adminthml/*;

bin/magento setup:upgrade;
bin/magento setup:db-schema:upgrade;
bin/magento setup:di:compile;
bin/magento setup:static-content:deploy -f;
bin/magento indexer:reindex;
bin/magento cache:clean;
bin/magento cache:flush;


php bin/magento setup:upgrade

before you run the deploy


Your domain has to point to the /pub/ directory.

In earlier versions, you could choose to point your domain either to / or /pub/. In 2.4, I experienced issues with pointing the domain to /.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.