Linux – Making Apache recognize MIME type of files without extension

apache-2.2debianlinuxmime

I have some old HTML files that were created elsewhere by someone else. Many of them don't, for some reason, have the .html extension on them. I don't want to have to change them if possible, but for some reason Apache can't seem to do any MIME magic to figure out their file type. I have the mime_magic mod enabled, along with the following in the sites section:

    MimeMagicFile /etc/magic

I should note that I'm using Debian Linux on this machine.

Best Answer

I tried the DefaultType workaround in my main conf file and it did not work for me. (My environment is an internal, thoroughly hacked-up version of Apache, so there may be a FileInfo directive or something overriding DefaultType and I can't find it. On standard installations it may work...)

What DID work: since all the extensionless files I'm dealing with are in one known directory, I added a Location block and used ForceType:

<Location "/directoryname">
ForceType text/plain
</Location>

You cannot use ForceType on a directory that should contain more than one type of file.