I'm working on a website, implemented as shtml, and when I try to load the home page (http://simplyclassicremodeling.com) from IE8, it says it can't open the file because it transferred as Content-Type "text.html". The page loads fine from Chrome, and loads (with some CSS issues that are not relevant here) in Firefox.

httpd.conf has:

Options Includes Indexes FollowSymLinks ExecCGI 
AddHandler cgi-script .cgi .pl
AddType text/html .shtml
AddHandler server-parsed .shtml

and further down:

AddType text/html .shtml 
AddOutputFilter INCLUDES .shtml
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript application/javascript

The HTTP headers, from a Telnet session, are:

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

Are the "AddType" and "AddOutputFilter" transposed? Based on this information, would you know why IE8 would think .shtml files are being sent as Content-Type: text.html? Is there a way to globally ask Apache, "If you're going to transfer as 'text.html', use 'text/html' instead?


  • Who knew IE8 could suck at this as well. – Tim Jan 27 '12 at 18:21

There is probably a bad line somewhere else in the httpd.conf or one of the Included files. I would check the main configuration and others with grep to track this down.

grep Includes httpd.conf
grep text.html httpd.conf

Alternatively, you can force the type using FilesMatch. Here's an example:

<FilesMatch "\.(shtml)$">
   # type only
   ForceType text/html
   # type and character set
   # ForceType 'text/html; charset=UTF-8'
  • Oh, nifty. I had completely missed that in the docs! This is definitely better than my answer. :-) – James O'Gorman Jan 27 '12 at 23:14
  • ssl.conf declared a type of text.html. Once that was text/html, IE could see it. – Christos Hayward Jan 28 '12 at 17:37

You could try rewriting the header if the browser is IE:

BrowserMatch MSIE
SetEnvIf Request_URI "\.shtml$" msie_ssi
Header set Content-Type text/html env=msie_ssi

(Caveat: This is untested but I think should work according to the mod_setenvif documentation.)

  • It looks like that would set the content-type for everything to text/html, including CSS, JavaScript, and images. Or am I misunderstanding? – Christos Hayward Jan 27 '12 at 22:47
  • If literally done like that, yes. You could add some extra SetEnvIfs. I'll update with an example. – James O'Gorman Jan 27 '12 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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