Js, CSS is not loading properly. enter image description here

7 Answers 7


Please check mod_rewrite enabled in your server and also check the directory symlinks like this in your server.

Open /etc/apache2/apache2.conf 

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  • Is /var/www/ need to be included? Aug 9, 2019 at 11:22
  • your using windows right..find the keyword like FollowSymlinks and give granted access. Aug 9, 2019 at 11:23
  • Yes, it is windows 10. I put like this <Directory /> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> but not working. It still shows the same thing. Aug 9, 2019 at 11:29
  • mod rewrite enabled or not?? Aug 9, 2019 at 11:33
  • Yes, I enabled it already. Actually, my other Magento project working well. But this one I copied from a friend not loading CSS, js. Aug 9, 2019 at 11:37

please check it pub/static/ inside htaccess exits or not same path pub/media/ inside check it after all command apply it

  • htaccess exists in both folders. Aug 9, 2019 at 11:03
  • change to other default magento htaccess use it on same path after cache clean and flush
    – Rv Singh
    Aug 9, 2019 at 11:07
  • please ip define in your url change to admin side core_config_data inside
    – Rv Singh
    Aug 9, 2019 at 11:07
  • admin page showing page not found like that. Aug 9, 2019 at 11:09
  • please try to all command
    – Rv Singh
    Aug 9, 2019 at 11:11

I solved this problem by running:

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
  • I got this error Apr 16, 2020 at 10:22
  • Too many arguments, expected arguments "command". Apr 16, 2020 at 10:23

This could be an issue with symlinks. I see that deploy.php worked for you, but you may also try deleting the resources from pub/static and seeing if the instructions from https://magento.stackexchange.com/a/64808/594 work for you. If so, then it may save you some time during development as it should be faster than running deploy.php.

I hope this will help

  • I followed those steps perfectly but it is not working. And admin page showing page not found like that. Aug 9, 2019 at 11:38

If you imported database from the server where secure connection (https) is enabled, you need to disable it in local copy of the database (because you probably doesn't have secure connection on a localhost):

bin/magento setup:store-config:set --use-secure=0 --use-secure-admin=0
bin/magento cache:flush

Another thing to check is any speed optimizer modules. I didn't notice my client had one called MagePow Speedoptimizer and it sneakily was moving the require.js from loading in the head section to the body which doesn't work well at all, so I disabled it.

There are other speedoptimizer modules too for Magento 2 that can cause this.


It could be the many reason for the same error.

In my case my base url was set as http but it will redirects to https protocol.

I have set https protocol in base url and it works.

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.