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!

1
  • Please upload pub folder files from fresh setup and run above command Commented Mar 29, 2018 at 16:08

2 Answers 2

7

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

1
  • thanks saviour :) Commented Nov 19, 2020 at 9:23
3

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 and acknowledge you have read our privacy policy.

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