css 不会加载,资源解释为样式表,但使用 MIME 类型 application/x-httpd-php 传输



我已经尝试了所有方法,但无法弄清楚这一点,我对服务器和设置它们不是很了解,该网站所在的公司决定从 GoDaddy 服务器运行他们的网站,这让我相信这可能是这个问题的根源,但我会尽力解释这一点。

我有一个简单的HTML页面,有一些css...当 CSS 包含在页面本身上时,它可以正常工作。

IE

<html>
<head>
     <style>
#topbanner {
position:absolute;
top: 0;
height: 40px;
width:100%;
background-color:#000;
opacity: .5;
}
#map {
margin: 0 auto;
background: url(img/jeanmap.png);
height:679px;
width: 1024px;
position: relative;
}
      </style>
</head>
<body>
   etc... etc...

但是,当我通过样式表链接相同的CSS样式时,我的页面上什么也没得到,实际上什么也没得到。

IE

    <html>
<head>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
   etc... etc...

在Firefox中进行测试时,我没有收到任何错误,并且我可以看到.css文件中的所有样式并且可以下载它,在Chrome中我看不到我的样式,但可以下载它,而在Chrome中我收到以下错误,Resource interpreted as Stylesheet but transferred with MIME type application/x-httpd-php

我还链接到一些javascript脚本,这些脚本给出相同的错误但确实加载,但显然没有任何效果,因为我的css是空的。

这里到底是什么问题,我以前从未发生过这种情况,而且很迷茫。

我不相信这是服务器问题,因为在根文件夹中我做了同样的事情并且工作正常,这只是在一个文件夹中,它仍然无法在那里工作

澄清这是我的文件结构

root/
    index.php
    css/
    img/
    js/
    problematic folder/
                  index.php
                  css/
                     style.css
                  img/
                  js/

拥有另一个 CSS 文件夹、另一个 IMG 文件夹和另一个 js 文件夹的原因是因为这是一个辅助项目,最终将在其自己的服务器上结束,但现在为了测试和制定设计,它嵌套在我的服务器上。

我的

根文件夹中有一个我的 .htaccess,其中包含以下内容...

# add various mime types
AddType text/html .html .htm
AddType image/x-icon .ico
AddType text/css .css
AddType text/javascript .js
AddType audio/mpeg .mp3
AddType audio/mp4 .m4a
AddType audio/ogg .ogg
AddType audio/ogg .oga
AddType audio/webm .webma
AddType audio/wav .wav
AddType video/mp4 .mp4
AddType video/webm .webm
AddType video/ogg .ogg

并且还尝试在有问题的目录中添加一个htAccess文件,但这也没有帮助

这可能是服务器配置问题。如果您使用的是Apache,请查看此处。

AddType text/css .css

相关内容

最新更新