Any time I’ve created my own XML file for RSS feeds, it’s been on a server running Apache, and it’s usually worked fine, barring semantic errors on my part. However getting it to work on a Windows Server running IIS is a slightly different matter, as I found out today.
IIS was constantly returning with a 404 error, which confused me for a while as I couldn’t figure out what wrong with my file. Copying a working RSS feed file and renaming it and placing it in the appropriate application directory produced the same results so I was sure it was not the file. So perhaps it was IIS.
As it turns out, it is, and quite rightly so to be honest. IIS’ default configuration does not recognise RSS files, and thus needs to be configured to do so. There is a default configuration for files with a .xml extension, but since XML files are generally used for a lot more than RSS, it’s best to make a separate definition.
So I renamed the RSS file with a .rss extension.
Then to configure IIS, follow these steps:
- Open IIS and navigate to the appropriate application/website
- Right click and choose ‘Properties’ from the menu
- Select the ‘HTTP Headers’ tab
- There’s a section at the bottom entitled ‘MIME Map’, and from that click on ‘File Types’
- Click ‘New Type’
- For the ‘Associated extension’ enter
- And for ‘Content type (MIME)’ enter
- Click ‘OK’ and then ‘Apply’
Feel free to restart the IIS server, although you shouldn’t have to.
Ensure that the HTML page link to the RSS file includes the RSS extension, e.g.
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="rssfeed.rss" />
Clear your browser’s cache, and try to access your RSS feed again. This time around, it should work.