1

Magento2.2 apache php7 server I moved the website from a Nginx server to this apache2 server. cleared cache, the magento is in default mode still so no need to re-deploy.

However now i get an error that says

Refused to apply style from 'pub/static/frontend/Smartwave/porto_child/en_US/css/styles-m.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.


Refused to apply style from ' pub/static/frontend/Smartwave/porto_child/en_US/css/styles-l.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

I already did a chmod -R 777 * in the website directory and also a chown -R ubuntu:ubuntu on the directory for the site site. so not sure what else needs to be done to fix this?

  • Did you manager to solve the problem? – Daniel Jul 2 at 9:16
0

In Chrome/Firefox browser if content-type header is mixed then link will not load. This is browser strict feature.

Can you open that files in new tab of both browsers? & Please verify the content & header - Content-Type in Network tab by press F12.

If you don't see the right content or Content-Type then run below command:

rm -Rf pub/static/frontend/*

php bin/magento setup:static-content:deploy -t Theme/name -f
0

Go to your layout xml file under the

app\code\yournamespace\yourmodule\view\frontend\layout

Here in the head section put your extension name before including CSS like -

<head>
   <css src="yournamespace_yourmodule::css/yourcssname.css" />
</head>
0

The same thing can happen if there is an error in your actual CSS file. This just happened to me which caused the is not a supported stylesheet MIME type, and strict MIME checking is enabled error. For example, I had this typo:

.message.global.cookie {
    background: rgba(220,20,60,0.9.5);
}

If you are familiar with CSS you will spot it right away. If not, it is the opacity value 0.9.5 which was invalid and should be 0.95 instead. After fixing the CSS typo the MIME error went away. The error can simply refer to an error in your CSS which isn't very clear in the error message that the browser throws.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.