0

I set up Magento 2 localhost migrated from the server.

but when load frontend showing like this

enter image description here

Pub/media CSS was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff in Magento 2

how I can fix this

Magento ver 2.2.6

ubuntu 18.04

PHP 7

0

Make sure you have .htaccess in pub/static. If you don't have file take a file from a fresh setup.

Then do static content deploy and clear cache.

If It's not working make sure you have enabled mod_rewrite in ubuntu

  • mine backend is working fine without any problem – prabhakaran7 Jul 23 '19 at 4:23
0
  1. Remove all files from var/ folder.
  2. Check for .htaccess in pub/static. If not exists, take a file from a fresh setup.
  3. Run the following commands

    php bin/magento setup:static-content:deploy -f
    php bin/magento indexer:reindex
    php bin/magento cache:clean
    
  • already there and i cleared cache – prabhakaran7 Jul 23 '19 at 4:22
  • but magento backend is working fine – prabhakaran7 Jul 23 '19 at 4:23
  • then flush cache and clear browser history then try in incognito mode – Teja Bhagavan Kollepara Jul 23 '19 at 4:23
  • tried not working – prabhakaran7 Jul 23 '19 at 5:50
0

I had the same issue. The reason was that we added a css file which didn't exist when enabling merging css. Please check your custom js or third party js. We can also check the log.

For example, file doesn't exist.

<css src="Vendor_Module::yourcustom.css"/>
  • i will check ..... – prabhakaran7 Jul 23 '19 at 12:08
  • @prabhakaran7 did your issue resolve? – Khoa TruongDinh Jul 26 '19 at 3:48
  • still i'm not yet checked... – prabhakaran7 Jul 26 '19 at 4:37
0

make sure .htaccess exist in pub/static

0

enter image description here Same problem I am getting on my localhost so for this I have tried below methods: * replace .htaccess file in pub/static folder (no luck) * after lot search I run this commands and successfully deployed

 sudo chmod -R 777 pub/ var/ app/
 sudo php bin/magento setup:upgrade
 sudo php bin/magento deploy:mode:set production
sudo chmod -R 777 pub/ var/ app/

After these commands all errors from console gone enter image description here

  • superb let me try – prabhakaran7 Nov 23 '19 at 13:50
  • Deploy mode in production works well... If this perfect then upvote my ans – Rohit Kaushik Nov 24 '19 at 14:40

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.