1

I created .htaccess file for the urlrewrite of the site that I'm working. After adding .htaccess it stopped loading JavaScript s and CSS s. So I then added AddType text/css .css and AddType text/javascript .js. But I get the same error. Following is my .htaccess code:

<IfModule mod_rewrite.c>

RewriteBase /downsouthlk.comV3/
RewriteEngine On

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

#Turn on the rewriting engine 

RewriteRule ^admin/dash/?$ /admin/dash.php [NC,L]
RewriteRule ^admin/addcity/?$ /admin/addCity.php [NC,L]


</IfModule>

This is the error that I get from chrome developer options:

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

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

Community
  • 1
  • 1
Janaka Dombawela
  • 1,337
  • 4
  • 26
  • 49

3 Answers3

1

You problem is use of relative links in your css/js links. Make sure to use absolute path in your css, js, images files rather than a relative one. Which means you have to make sure path of these files start either with http:// or a slash /.

OR else you can try adding this in your page's HTML header: <base href="/" />

anubhava
  • 761,203
  • 64
  • 569
  • 643
0

You need to configure the server to send a JavaScript response with


Content-Type: application/javascript
system7
  • 130
  • 1
  • 8
  • No, when you include a javascript file in the html, use application/javascript instead of text/javscript. Maybe you have to change the .htaccess file also. – system7 Apr 01 '14 at 07:12
  • I did that. Both html and .htaccess. sry but still the same. – Janaka Dombawela Apr 01 '14 at 07:14
  • I found a same issue on this page. http://stackoverflow.com/questions/5349939/resource-interpreted-as-script-but-transferred-with-mime-type-text-html – system7 Apr 01 '14 at 07:23
0

Use AddHandler

AddHandler text/css .css
AddType text/css .css

AddHandler text/javascript .js
AddType text/javascript .js