I have a Magento 2.2.5 based website and when I do a below command:

php bin/magento setup:di:compile
and then
php bin/magento setup:static-content:deploy

And then I look in the


And the same CSS file that is in


Is not copied over to the pub static folder? I checked and the Magento mode is production. Also I made sure the pub static is writable. I also tried renaming the static folder to 'static---' and then recompiled and redeployed and again the CSS file for some reason was not there in pub static?

  • Did you not deleted .htaccess in pub/static/.htaccess? Dec 14, 2018 at 7:45

2 Answers 2


Download .htaccess from official Magento 2 repository

Run below command.

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

Never delete .htaccess file from pub/static


Try below command step by step and check again.

Step 1) Add .htaccess file from native Magento 2 source.

Step 2) php bin/magento setup:upgrade

Step 3) php bin/magento setup:static-content:deploy -f

Step 4) php bin/magento cache:flush

Note: Do not delete .htaccess file from pub/static

Hope it help!

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.