Forum Moderators: phranque

Message Too Old, No Replies

How Apache handles file types in Content Negotiation?

An example

         

iaaa

5:03 pm on Apr 27, 2006 (gmt 0)

10+ Year Member



Hi,

I have recently enabled content negotiation and I am very happy about the whole thing. Still although I dont' have any problems with .html and image files (png, jpg), it doesn't seem to like extensionless .rss files. I have to refer to the rss file using the full url (including the .rss) otherwise it won't find the file. Is there any way to declare the rss filetype i.e. type="application/rss+xml" for Apache to understand it so I can refer to it without the .rss? In the .htaccess maybe. Is that possible?

Regards

jdMorgan

6:22 pm on Apr 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See AddType [httpd.apache.org] in Apache mod_mime.

Jim

iaaa

8:53 pm on Apr 27, 2006 (gmt 0)

10+ Year Member



Thanks Jim,

So in my case for rss files:

AddType application/rss+xml .rss

Cheers!

iaaa

9:03 pm on Apr 27, 2006 (gmt 0)

10+ Year Member



Thinking about it again, removing the extension from the RSS file could cause confusion (maybe to newsreader applications!?). The AddType definately will prove handy for other files. Do you know which file types are already included within a given version of Apache? The version my host is running is 2.0.52. I presume that new file types will be added in later versions of Apache..

jdMorgan

9:15 pm on Apr 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure what defaults Apache might have, or what your host might have configured. Best practice is to always check the MIME types of 'new' files using a server headers checker -- either on-line, or by using something like the Live Headers extension to Firefox.

Jim