我在一个网站上工作,实施为shtml,当我尝试从IE8加载主页( http://simplyclassicremodeling.com ),它说,它不能打开该文件,因为它作为内容types“ text.html”。 Chrome浏览器可以正常加载页面,并且可以在Firefox中加载(这里有一些不相关的CSS问题)。
httpd.conf有:
Options Includes Indexes FollowSymLinks ExecCGI AddHandler cgi-script .cgi .pl AddType text/html .shtml AddHandler server-parsed .shtml
并进一步下降:
AddType text/html .shtml AddOutputFilter INCLUDES .shtml AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript application/javascript
来自Telnet会话的HTTP头是:
GET http://simplyclassicremodeling.com/ HTTP/1.0 HTTP/1.1 200 OK Date: Fri, 27 Jan 2012 21:57:54 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.9-dev DAV/2 PHP/5.2.6 Accept-Ranges: bytes Cache-Control: max-age=2592000, public Expires: Sun, 26 Feb 2012 21:57:54 GMT X-UA-Compatible: IE=Edge,chrome=1 Connection: close Content-Type: text.html
“AddType”和“AddOutputFilter”转置了吗? 根据这些信息,你会知道为什么IE8会认为.shtml文件是作为Content-Type发送的:text.html? 有没有一种方法可以在全球范围内询问Apache:“如果您要以”text.html“的forms传输,请使用”text / html“代替?
谢谢,
在httpd.conf或其中一个包含的文件中可能有其他地方的坏行。 我会检查主configuration和其他与grep来跟踪这个。
grep Includes httpd.conf grep text.html httpd.conf
或者,您可以使用FilesMatch强制使用该types。 这是一个例子:
<FilesMatch "\.(shtml)$"> # type only ForceType text/html # type and character set # ForceType 'text/html; charset=UTF-8' </FilesMatch>
如果浏览器是IE,你可以尝试重写头文件:
BrowserMatch MSIE SetEnvIf Request_URI "\.shtml$" msie_ssi Header set Content-Type text/html env=msie_ssi
(警告:这是未经testing,但我认为应根据mod_setenvif文档工作 。)