Is there a way to make Apache follow symlinks for the header content-type?

If I serve a file named image.jpg the header content-type is sent as image/jpeg, but if I make a softlink named image that points to image.jpg the content-type is sent as text/plain.

Is there a way to send the same content type as if it were reading the original file?


Solution 1:

The content-type is determined by the mappings in the MIME-Magic file supplied with apache. This has a mapping for *.jpg to image/jpeg.

You can force the content-type inside a container, like so:

<Location /URI/of/images>
   ForceType image/jpeg
</Location>

http://httpd.apache.org/docs/2.2/mod/core.html#forcetype