2

I deleted the pub folder of my magento installation. Then I used

php bin/magento setup:static-content:deploy

and now the site has no CSS at all. How can I fix that?

Thanks!

  • Please upload pub folder files from fresh setup and run above command – Purushotam Sharma Mar 29 '18 at 16:08
6

Don't delete the entire pub folder. Delete pub/static/* if/when needed.

You are most likely missing three critical files that will not be automatically regenerated:

pub/.htaccess 
pub/media/.htaccess  
pub/static/.htaccess

If you have a backup or a local dev site, I suggest finding and restoring them from there. Otherwise, you can find them in the appropriate branch of the Magento github repository (depending on what version you are running): https://github.com/magento/magento2

2

Well if you have deleted pub folder then even though you run

php bin/magento setup:static-content:deploy

It will still not generate, because if its pub/static then it will generate automatically.

So better to create pub directory manually again

Then upload media folder in it from your backend.

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

It will generate static folder again and css is also load back again !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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