2

I have setup Magento 2.2.3 enterprise edition store in my local windows system.

Previously, the CSS and JS were loading and the store was appearing fine.

Store's Admin Panel Screenshot

StoreFront Screenshot

But recently the CSS and JS files are not loading (shows 404 error when checked in chrome DevTools network).

Chrome DevTools Screenshot

I have tried giving commands like cache:clean, cache:flush, indexer:reindex, setup:di:compile and also setup:static-content:deploy but the issue is not resolved.

7 Answers 7

4

Follow below steps:

  1. Make new static folder under pub folder and copy .htaccess file from old pub/static folder to new static folder.

  2. Run query in database : INSERT INTO core_config_data (scope, scope_id, path, value) VALUES ('default', 0, 'dev/static/sign', '0');

  3. Run php bin/magento setup:static-content:deploy (add -f argument for magento 2.2.x)

  4. Run php bin/magento cache:flush

Now, test it and the css should load.

2
  • its working fine :) May 27, 2019 at 7:31
  • I'm join to this community right now just to voteup you. Thank you so much Apr 24, 2020 at 7:28
2

Run Commands from your Magento root directory

  • php bin/magento setup:upgrade

  • php bin/magento setup:static-content:deploy -f

0

Run below commands

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:clean
0

Please check once permission of the folder and files . for that follow below link : Magento 2 folder/file permissions.

Also check is there ht-access file in pub folder after that run command:

php bin/magento setup:static-content:deploy

1
  • if after this still not found the soluction you can follow this step: Remove pub/static [Keep the .htaccess backed up and copy it again] Remove var/cache Remove var/composer_home Remove var/generation Remove var/page_cache Remove var/view_preprocessed run php bin/magento setup:static-content:deploy
    – shail
    Jun 22, 2018 at 5:27
0

Go to your htaccess file and find the

Options +FollowSymLinks

Comment this line and then try again

#Options +FollowSymLinks

Do this in pub directory htaccess, media, and also on root . Still if css and js are not loading then let me know I will provide you one more solution for this

2
  • Didn't work. Should I give any commands after commenting? Jun 22, 2018 at 5:54
  • See, what happens when we have magento installed.. static files are generated in pub folder. So firstly we have to check there permissions that files are permitted to get generated or not? then if we are in developer mode and we don't need to manually deploy the static files i.e the answers provided by others.. and now your case try to check whether you have files in pub/ static directory or not and then check by direct hitting any css/ js URL.. and check if htaccess is available there or not and it is commented as per my comment
    – Vivek
    Jun 22, 2018 at 5:59
0

When U Install Magento That time Not Add The Js file in pub folder if u Run below command than all Js and templates file deploy in pub Folder

now run this command step by step

php -dmemory_limit=5G bin/magento setup:static-content:deploy -f
php bin/magento cache:flush

If not working than after u can also run with your store But if you know which store and with language store you create For example

php -dmemory_limit=5G bin/magento setup:static-content:deploy -f en_US

0

This is a permission issue. You need to give full permission to your project directory.

sudo chmod -R 777 directoryname

Hope this will work :)

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.