Apache2 won't load css files on Debian 6 (Squeeze)

1

After using nginx for a few months, which worked pretty well, I decided to switch back to Apache. Now, I have just installed apache2, but it seems like it won't load my CSS files. I've been struggling with it for hours now and I don't know what else to do; I just did a clean install from Apache and created this virtual host (see below) but it still doesn't work.

E.g.: http://shurl.be/

This is the virtualhost I'm using for it (note that I have commented out the rewrite rules):

<VirtualHost *:80>
     ServerAdmin webmaster@wouterds.be
     ServerName shurl.be
     ServerAlias www.shurl.be
     DocumentRoot /srv/www/www.shurl.be/public_html/
     ErrorLog /srv/www/www.shurl.be/logs/error.log
     CustomLog /srv/www/www.shurl.be/logs/access.log combined

     #     RewriteEngine On
     #     RewriteCond %{REQUEST_FILENAME} !-f
     #     RewriteRule ^/?([^/]*)/?$ /index.php?a1=$1 [L]
</VirtualHost>

wouterds

Posted 2013-02-17T15:33:14.280

Reputation: 111

Answers

2

Enable mod_mime and add the following lines in your httpd.conf (or a .htaccess):

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

Simon

Posted 2013-02-17T15:33:14.280

Reputation: 36

Thanks, works now. Very weird, it should just work out of the box. I should't add this manually.

And no, I haven't changed ANYTHING to the configuration files. That's what makes it so weird it didn't just work by itself. – None – 2013-02-17T15:57:17.607

@Simon I am having same issues, however followed this answer and still cannot load .css files – Richard – 2013-02-18T17:17:25.953

What do you mean by 'not loading'?

Is it not adding the text/css Content-Type header or is the file not sent to the browseR? – Simon – 2013-02-27T11:10:04.260

0

When I load your website and look into the console, it displays the following error

[16:37:08.652] The stylesheet http://shurl.be/layout/stylesheets/css/test.css was not loaded because its MIME type, "text/plain", is not "text/css". @ http://shurl.be/

It seems you're missing an appropriate mime type. Although, the default configuration of debian should do this already.

Olaf Dietsche

Posted 2013-02-17T15:33:14.280

Reputation: 421

Exactly it should just work.. Anyway, how can I add it manually? – None – 2013-02-17T15:48:49.203