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 [email protected]
     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>

2 Answers 2

2

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

AddType text/css .css
AddType text/javascript .js
3
  • 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.
    – WouterDS
    Commented Feb 17, 2013 at 15:57
  • @Simon I am having same issues, however followed this answer and still cannot load .css files
    – Richard
    Commented Feb 18, 2013 at 17:17
  • 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
    Commented Feb 27, 2013 at 11:10
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.

1
  • Exactly it should just work.. Anyway, how can I add it manually?
    – WouterDS
    Commented Feb 17, 2013 at 15:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .