MIME type error - Refused to apply style / Refused to execute script. Strict MIME checking is enabled
Symptom:
Refused to apply style / Refused to execute script due to Strict MIME checking.
This usually occurs when Magento hasn’t generated static content correctly. It can also appear on a vanilla Magento install and isn’t necessarily related to a theme or extension.
In most cases, the error disappears after setting correct permissions and regenerating static content.
Solution 1 — Fix permissions, switch modes, and deploy static content
- Set correct Magento permissions
Follow the Basic Permissions Setup guide:
- Switch to Developer mode, then to Production mode
This cleans caches, compiles code, and generates static content:
- Deploy static content for each locale (if you use locales other than
en_US, e.g.,nl_NL,en_GB)
Example command (run from Magento root):
php bin/magento setup:static-content:deploy -f en_GB
If the error persists, there may be an issue with missing.htaccessinpub/static.
Solution 2 — Restore missing .htaccess in pub/static
- Navigate to:
pub/static/
- Check for
.htaccess(it’s a hidden file; pressCtrl+Hin many file managers to reveal).
- If missing, copy the version-appropriate
.htaccessfile intopub/static/from your Magento source for your exact Magento version.
- Clear caches and retest:
- Clear browser cache
- Clear Magento cache
Why this works
- Permissions & ownership ensure the web server can write static assets.
- Mode switch + static deploy rebuilds static files with correct headers and paths.
.htaccessinpub/staticsets proper MIME types and routing rules required by Magento’s static content server.
Updated on: 16/09/2025
Thank you!
