The stylesheet css/style.css was not loaded because its MIME type, "text/html", is not "text/css"

5,417

Solution 1

Mime types for CSS and javascript should be enabled per default. Check if the mime module is loaded, by running:

apachectl -M | grep mime

It should return "mime_module (shared)". If not, enable the mime module by running

sudo a2enmod mime

If the mime module is enabled, but those types are not defined, you can add them to the file /etc/mime.types (for the whole system) or /etc/apache2/mods-enabled/mime.conf (for apache). If you want to use .htaccess file, you have to enable them first (https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles), but I would recommend to make sure that these types are enabled centrally.

Solution 2

I too had the same issue. I had imported the bootstrap file in my application.css at the top. It was causing me issues.

So I placed the same import at the bottom after the comment lines in the application.css file. It worked like a charm!

Share:
5,417

Related videos on Youtube

chris-kuhr
Author by

chris-kuhr

Updated on September 18, 2022

Comments

  • chris-kuhr
    chris-kuhr over 1 year

    I tried the solution proposed in this thread: Apache2 won't load css files on Debian 6 (Squeeze)

    I added .htaccess files in every directory, containing

    AddType text/css .css   
    AddType text/javascript .js   
    

    But it did not work.

    Neigther worked the Apache howto http://httpd.apache.org/docs/2.2/howto/htaccess.html#page-header, telling me to place the types in the Directory directive in apache2.conf

    The mime_module (shared) is loaded.

    Anything I found via Google led me to one of those two solutions.

    What am I doing wrong?

  • veljkoz
    veljkoz over 6 years
    Unbelievably, this was actually the issue for me as well...