Atom MIME Type Woes

Album Cover: Abbey Road

"She's killer-diller when she's dressed to the hilt."
The Beatles / Polythene Pam

Posted on February 07, 2004 4:02 PM in XML
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

Once I finally had an Atom feed available for my site, I started pondering its handling by browsers such as IE and Mozilla. Because I had based my feed generation code off of the feed available at, I noticed a clear difference between the way Mozilla handled Mark Pilgrim's feed as opposed to the way it handled mine. Mark was clearly providing his feed with the application/atom+xml MIME type described at

I therefore tried to add an .htaccess file to the directory my feed was in using the following directive:

AddType application/atom+xml .xml

However, doing so failed to serve my feed in the specified MIME type. Instead, it continued to show up in the browser as plain old text/xml. So, I decided to dig further, contacting my web service provider, Mark Pilgrim and Joe Gregorio to find out what I was doing wrong.

My web service provider told me that "the browser will override and try to display as .xml in the browser." Not quite as technical an answer as I was hoping for, so I waited on the other two responses. Mark Pilgrim wrote back saying that serving my Atom feed with the application/atom+xml MIME type was not absolutely vital. He said that the following MIME types are acceptable, ordered by preference:

  1. application/atom+xml
  2. application/xml
  3. text/xml

His answer was good news, for sure, but being the perfectionist that I am, I couldn't just settle for number 3. As it turns out, it was Joe Gregorio's response that would take me where I wanted to go. He simply pointed out a different Apache directive that might serve the purpose I was going for, the ForceType directive.

The ForceType directive allows you to specify that any files in the specified directory (or current directory if you are using the directive in an .htaccess file) should be served as the MIME type you provide. So, I quickly moved my Atom feed into its own "feed" folder, and added the following line to an .htaccess file in that folder:

ForceType application/atom+xml

Now, as far as I can tell, my newly relocated Atom feed is being served as it should be, as application/atom+xml instead of text/xml.

I have subsequently updated my previous post and the XML Feed button in the sidebar so they point to the new location. I doubt anyone has subscribed to my feed at this point, so I'll refrain from advising that anyone update their subscriptions ;)


No one has added any comments.

Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.


Email Address:



Check this box if you hate spam.