prevent errors on bad requests

These are minor changes I made for my usage.  Current Apache requires slightly different setup (at least on my Ubuntu based server), on bad requests I'd rather user see page as HTML than server error so reordered with else clause for all not otherwise handled formats, and the third patch supporting rtf was just for me.  Thank you for original version, great for my web sites!