Magento – Css and Js files are not loading in admin panel and storefront

localhostmagento2magento2.2.3windows

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.

Best Answer

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.

Related Topic