Making Apache recognize MIME type of files without extension

Solution 1:

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.

Solution 2:

Assume all files not containing a period are PHP:

      <FilesMatch "^[^\.]+$">
              ForceType application/x-httpd-php
      </FilesMatch>

Solution 3:

A simple warkaround, not really a solution maybe, would be to change the DefaultType as follows:

DefaultType text/html

This would assure every non recognized file will be treated as html.

This is not a true solution, I repeat, but it is simple and may have sense if your server serves mainly html contents