10

This is my html:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv = "Content-Language" content = "en"/>
        <meta http-equiv = "Content-Type" content="text/html; charset=utf-8">
        <link rel="stylesheet" type="text/css" href="/xxx/app/www/style.css">

Now when I load the page, Safari's inspector gives me:

Resource interpreted as stylesheet but transferred with MIME type text/html

I'm working on localhost with MAMP. I'm not sure what to modify to get this to work. I read that this might be a server problem of some kind.

How do I solve it?

Shoe
  • 74,840
  • 36
  • 166
  • 272
  • similar question( if not exact one) --> http://stackoverflow.com/questions/3467404/chrome-says-resource-interpreted-as-script-but-transferred-with-mime-type-text – rt2800 May 11 '12 at 14:48
  • Check this Answer http://stackoverflow.com/a/37024887/4762396 – abdul rashid May 04 '16 at 10:22
  • Does this answer your question? [Resource interpreted as stylesheet but transferred with MIME type text/html (seems not related with web server)](https://stackoverflow.com/questions/22631158/resource-interpreted-as-stylesheet-but-transferred-with-mime-type-text-html-see) – Captain Levi Dec 14 '19 at 04:24

3 Answers3

11

Create an .htaccess file into your root folder (or update the existing one) with this line inside

AddType text/css .css 

this will tell apache to send the right content-type header for .css file

Fabrizio Calderan
  • 120,726
  • 26
  • 164
  • 177
0

There is possibility that not just css resources were interpreted wrongly. It maybe a problem of your webserver configuration.

The best way to check is to go to Chrome -> Network tab and check responses section for each request. Also you can run $ curl -I http://path_to_file_or_page with terminal and have a look at response, you should see it in following format, e.g. Content-Type: image/jpeg


So, if it will occur that webserver (apache) does it for all filesthen you can try to solve the problem in following way:

Check your /etc/apache2/apache2.conf If there are any SetHandler application/x-httpd-php line, try to comment it and then reload your apache by $ sudo system apache2 reload

Let us know if the problem is still there.

Sid
  • 4,302
  • 3
  • 26
  • 27
0

It could be that your web server is properly configured but it really is returning HTML instead of CSS.

Check that you have the correct path, spelling, case, etc. Hit the URL directly and see what comes back. Your web server might be responding with an error page (HTML) and a 200-Ok instead of a 404-Not Found.

I'm not saying this ever happened to me...

mcarson
  • 2,602
  • 2
  • 14
  • 15