Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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>
share|improve this question

migrated from stackoverflow.com Feb 17 '13 at 20:07

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 1 down vote accepted

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

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

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.

share|improve this answer
    
Exactly it should just work.. Anyway, how can I add it manually? –  WouterDS Feb 17 '13 at 15:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.