Magento 2 CSS – Fix Frontend and Backend CSS Issues

cssjavascriptmagento2PHP

I have installed Magento 2.2.5 on my server using Cpanel. The problem I am facing is my CSS is not working properly. The Url of my site is http://emcd.tk/. I've looked on so many solutions but didn't find any proper one. I also attached the picture showing errors.

enter image description here

Things I've tried so far:

  1. Giviving permission for var & pub folders.
  2. php bin/magento setup:static-content:deploy
  3. Do reindex php bin/magento indexer:reindex
  4. Clearing cache using commands [php bin/magento cache:clean] and [php bin/magento cache:flush]

The reason of doing this if you take the source code and check, the CSS & JS file path may wrong. So that the style won’t render in a browser even I tried to make it correct but didn't work properly.

I would appreciate any kind of help. Thank you

Best Answer

It has happened to me several times. This must be some kind of installation/compilation or deployment.

Try and run this command:

rm -rf pub/static/*; php bin/magento setup:upgrade; 
php bin/magento setup:di:compile; php bin/magento setup:static-content:deploy;    

If it doesn't work after this, you should try re-installing.

Related Topic