10

I am using Magento 2 in Windows 10 using xampp.

I have installed magento2 and it was running perfectly. After that, I migrate data from magento1 with migration tool.

Now I am having an error with the resource from “ (CSS path)” was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff).

Already tried to deploy static content many times with cache and index refresh. URL rewrite is already ON.

Can anyone please help me out?

Thanks

2
  • did you check whether the files in the error is exist in the given path ? Jan 1, 2017 at 8:46
  • Yes, All files are exist. but when I check in firebug, its give me error like 404 file not found and for same file its give me another error like Mime Type mismatch. Jan 1, 2017 at 17:21

5 Answers 5

8

Download the .htaccess file for your specific magento version and put it inside the pub/static folder in the default magento directory and these errors should vanish.

I also faced a very similar issue. After a lot of deliberation I was able to understand that this problem mainly occurred because I deleted the .htaccess file inside the pub/static folder.

2
  • I still have the same .htaccess file inside pub/static/ but still i get the error. I also downloaded the file specific to my magento version and compared it to the old file and they are exactly same.
    – Nausif
    Sep 19, 2017 at 5:57
  • and where can we find these .htaccess files? Dec 30, 2019 at 18:04
4

I had the same error and it turned out that the mismatch error was wrong. I came across this: https://github.com/angular/angular-cli/issues/10325 which explained that the mismatch error is a red herring and in fact the real error is a 404 fie not found. You should be able to work out if this applies to you by opening the page in chrome, going to the console and clicking on a file name that's erroring. For me it gave a file not found. Obviously you then need to work out why the file isn't there.

2
  • For me en_US/jquery.js was missing after minimising JS. I'm not sure what was referring to the non minimised version but manually adding it fixed it for me. Apr 1, 2020 at 14:50
  • 1
    Give this person a medal, saviour Sep 13, 2020 at 17:12
1

The issue may related to the fact that there's no Symlinks on Windows. There's 2 ways of fixing that:

1. Changing setting in file

In app/etc/di.xml change

Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink

to:

Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

2. Changing settings in Configuration

(From https://magento.stackexchange.com/a/95077/44597)

Go to Stores => Configuration => Advanced => Developer => Template Settings and change Allow Symlinks => No

0

I moved away from using m2 on wamp / xampp within windows for exactly this reason. Have you considered docker? https://github.com/meanbee/docker-magento2

0

in my case it was all folder permession , the easy fix is to just do the following:

1- change the /pub folder permission to 777:

sudo chmod 777 pub -Rf

2- redeploy the site static contents:

bin/magento setup:static-content:deploy -f

in case u have multi-lang site, write like this:

bin/magento setup:static-content:deploy -f en_US ar_SA

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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