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

Mohit Kumar Arora
  • 9,951
  • 7
  • 27
  • 55
Bhavesh Dave
  • 101
  • 1
  • 1
  • 3

5 Answers5

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.

Teja Bhagavan Kollepara
  • 3,816
  • 5
  • 32
  • 69
Saibal Roy
  • 89
  • 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 '17 at 05:57
  • and where can we find these .htaccess files? – Nick Rolando Dec 30 '19 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.

PedroKTFC
  • 355
  • 4
  • 16
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

srokatonie
  • 121
  • 7
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

Dominic Pixie
  • 7,520
  • 4
  • 17
  • 56
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