[resolved] RSS 2.0 feed sends content as text/html instead of text/xml (4 posts)

  1. sairuh
    Posted 8 years ago #


    I've noticed that my RSS 2.0 feed (below) is sending out content as text/html rather than text/xml:


    Why is that, and how would I fix it so that it sends text/xml instead? My wp-rss2.php file sets the content as text/xml in the header, so I'm not sure what's causing the problem.

    I have also tried adding "AddType text/xml .rss" (no quotes) to the .htaccess, but that didn't work either.

    Thanks in advance!

  2. sairuh
    Posted 8 years ago #

    Should clarify why the text/html is a problem (in addition to causing a warning in feed validation): some readers of my blog aren't able to read articles with their rss clients (e.g., sitescooper) because of the incorrect content-type.

    Other than using a 3rd party feed service like Feedburner, is there a way to make the content-type actually resolve as text/xml? For example, so that the feed URL points to something like an .xml or .rss file (e.g., index.xml)?

  3. foolswisdom
    Posted 8 years ago #

    Looking at the headers it seems very likely that you are doing no-www or something in your .htaccess .

    $ lynx -dump -head http://www.iwaruna.com/feed
    HTTP/1.1 301 Moved Permanently
    Location: http://iwaruna.com/feed

    That is why the mime type is text/html , that is as expected.

    $ lynx -dump -head http://iwaruna.com/feed | grep -i content-type
    Content-Type: text/xml; charset=UTF-8

    So in closing http://www.iwaruna.com/feed/ is not the address of your feed, http://iwaruna.com/feed is.

  4. sairuh
    Posted 8 years ago #

    Ah, so the redirect from www to the non-www version causes the resulting content to be text/html. Hadn't realized that. Fwiw, I use a URL rewrite rule for that redirect in my .htaccess --but I admit I'm not familiar enough with Apache inner-workings to understand why it behaves the way it does.

    At first I thought the wrong content-type might've been due to a plugin conflict, but testing with all of them off (and turning them on one by one) didn't seem to resolve the original problem. I also had wondered if it was the mysteriously erratic issue mentioned in the "Feeds not served as xml" forum thread.

    In any case, thanks for the explanation! When I distribute my feed link, I'll make sure to use the proper form of the URL.

Topic Closed

This topic has been closed to new replies.

About this Topic