skip to Main Content

My website is in default mode only. After run "setup:upgrade" my web does not load the resources css or js. "Refused to apply style from ” because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled."

Any idea what might be causing this problem?

4

Answers


  1. If you are using Linux then change the mode to developer and then run php bin/magento cache:flush from the document root of the webserver.

    If you are using Windows then please follow the below steps:

    1. change the mode to developer
    2. run php bin/magento cache:flush from the project directory
    3. run bin/magento setup:static-content:deploy -f from the project directory

    Please let me know how it goes!

    Login or Signup to reply.
  2. Try this

    sudo su
    
    cd /var/www/html/magento2
    

    Set permissions to the files as follows

    find . -type f -exec chmod 644 {} ;
    

    Set permissions to the directories as follows

    find . -type d -exec chmod 755 {} ;
    

    Set permissions to special directories: as follows (these commands solve your file uploading issue)

    find ./var -type d -exec chmod 777 {} ;
    
    find ./pub/media -type d -exec chmod 777 {} ;
    
    find ./pub/static -type d -exec chmod 777 {} ;
    
    Login or Signup to reply.
  3. Solution –

    1. In file /etc/apache2/apache2.conf Navigate <Directory /var/www/>, Change "AllowOverride None" to "AllowOverride All" 2. Add this at last in env.php located at <MagentoRootDirectory/app/etc>
    `'system' => [
           'default' => [
               'web' => [
                   'unsecure' => [
                       'base_media_url' => '{{secure_base_url}}pub/media/',
                       'base_static_url' => '{{secure_base_url}}pub/static/'
                   ],
                   'secure' => [
                       'base_media_url' => '{{secure_base_url}}pub/media/',
                       'base_static_url' => '{{secure_base_url}}pub/static/'
                   ]
               ]
           ]
       ]`
    1. In etc/di.xml, Search <item name="view_preprocessed" xsi:type="object"> Under that Modify this MagentoFrameworkAppViewAssetMaterializationStrategySymlink to MagentoFrameworkAppViewAssetMaterializationStrategyCopy
    2. Add this in db INSERT INTO core_config_data (path, value) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value = 0;
    3. Add this in db UPDATE core_config_data SET value = '0' WHERE core_config_data.path LIKE '%web/seo/use_rewrites%';
    4. Run this command, sudo a2enmod rewrite
    Login or Signup to reply.
  4. Please check the .htaccess file in pub/static/.htaccess. If not then please add it.

    thanks!!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search