Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting a content type header for files with no extension in Apache

    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.

  • #2
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Code:
    DefaultType text/html

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Y'know, I knew that. I don't know why it didn't occur to me before. Thanks!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •