View Full Version : Setting a content type header for files with no extension in Apache

10-30-2004, 02:33 AM
Hey all,

My company is running web server where some of the files do not have a file extension. By default, if the file has no extension, then the server can't send the file as a specific type. By default, these files will be sent as text/plain.

Is there a way to, by default, send all files with no file extension as a specific content type? Such as, say, text/html?

Our engineers tested everything in Internet Explorer. Since IE practices "content sniffing" rather than looking at the document headers, everything appeared to be kosher. Browsers that properly look at the document header, such as Mozilla, are seeing raw HTML code since the document is being sent as text/plain.

Aside from adding file extensions (which simply won't happen in this company), is there something I can set in the httpd.conf file that will force all non-extensioned pages to be sent as text/html?

I'm looking for an answer (or answers) that applies to Apache 1.3.x and 2.0.x.

10-30-2004, 04:15 AM
DefaultType text/html

10-31-2004, 06:58 PM
Y'know, I knew that. I don't know why it didn't occur to me before. Thanks!