I just installed a fresh Magento 2.3.1, and I ran the following code to deploy sampledata. bin/magento sampledata:deploy

The sample data are successfully installed but styles.css is not loading. I have checked pub/media folder, and I can see the styles.css does exist.

I tried the following step to fix the problem

  1. bin/magento setup:upgrade , bin/magento setup:di:compile and bin/magento cache:flush

  2. I cleared all content from folder generated, var/cache, var/page_cache, var/view_preprocessed, pub/static/ and flushed cache again.

  3. I give pub folder 777 permission.

but the styles.css is still not loaded on the frontpage.

This is the first time I experienced this weird issue. any suggestions?

I'm using luma theme and Magento 2.3.1

enter image description here


styles-m.css and styles-l.css are loaded successfully. it's only the pub/media/styles.css not loaded.

  • Can you please check for any console logs in the browser? Any error logs Commented Jul 8, 2019 at 14:24
  • Just checked console tlog. no errors, but there's a warning saying "jquery-migrate.js:45 JQMIGRATE: jQuery.attrFn is deprecated". This should be the problem? Commented Jul 8, 2019 at 14:27
  • Is it default Magento or you have made changes like installing third-party extensions or your own? Commented Jul 8, 2019 at 14:29
  • @RajMohanR I did install some third-party extensions. Commented Jul 9, 2019 at 8:51
  • In the browser side for the CSS URL's what response did it display either 404 or some thing else? Commented Jul 9, 2019 at 8:59

4 Answers 4


You can change this setting by login to your Magento

admin panel -> then go to Stores>Configuration>Advanced>Developer>Sign Static Files (dev_static_sign) -> No.


You can also disable this from database by running below query :

insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);

and also check

1) Open app/etc/di.xml

2) Replace all Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink occurrences with Magento\Framework\App\View\Asset\MaterializationStrategy\Copy


  • I have tried all metod you mentioned, and cleared both Magento and browser cache. the styles.css is still not loaded on the frontend. really weird issue. Commented Jul 9, 2019 at 8:57

I doubt if you are still waiting for an answer on this, but in case it helps others: The Luma demo site loads the pub/media/styles.css through the backend. So in the backend:

  1. go to Content->Design->Configuration

  2. click the Action->Edit button for the site you are working on,

  3. Expand the HTML Head section,

  4. Add this text to Scripts and Stylesheets:


<link  rel="stylesheet" type="text/css"  media="all" href="{{MEDIA_URL}} styles.css" />

Then clear the cache and reload. (You can check this in the Luma backend first -- that is what I based this on.)

This strikes me as odd for the demo -- it's not documented as far as I can tell and it doesn't fit with any of the magento online docs describing how to make style changes. On top of that, this styles.css file is compacted and hard to read, and I could not find the source for it.

I wanted a version of it that I could make some sense out of, so I used sed to add new lines and semicolons. I had to hand edit it a bit because my sed scripts didn't handle two "}} characters in a row properly.

I am putting this file here in case it helps anyone.


I found this problem in this moment and change the .htaccess into the folder /pub it works now!! :D


first you need remove temp folder :

rm -rf var/di/ var/generation/ var/composer_home var/cache/ var/tmp/ var/page_cache/ var/session/ var/view_preprocessed/ pub/static/frontend 

Add Code in mysql :

insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0); 

enter image description here

click go run all commands :

php bin/magento setup:upgrade 
php bin/magento setup:di:compile 
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
php bin/magento cache:clean 

change folder permission :

sudo chmod -R 0777 ../folder-Name


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.