How to redirect RSS feeds to a subdomain? (20 posts)

  1. I wanted to monitor my bandwidth usage for RSS feeds, kinda like how Matt did. Matt was nice enough to reply to my email, simply stating:

    "I just made a subdomain and linked the files. Maybe your host can help you more."

    So, I posted in my host's forums, and this was his response.

    Any further thoughts on how to accomplish this?

  2. Kafkaesqui

    Posted 10 years ago #

    I did a bit of experimenting. I made a copy of wp-feed.php along with the files for the various feed-types, edited each so they have the full and correct path (to my blog's domain) for wp-blog-header.php, and uploaded these to my main domain's root. I then added these two lines to the main domain's .htaccess:

    RewriteRule ^feed/(feed|rdf|rss|rss2|atom)/?$ wp-feed.php?feed=$1 [QSA]
    RewriteRule ^(feed|rdf|rss|rss2|atom)/?$ wp-feed.php?feed=$1 [QSA]

    Now I can retrieve my feeds this way:




    Etc. This seems to be how Matt handled it (though he may just be pointing feed/ at wp-rss2.php).

  3. Yikes. Latin! *LoL* Thanks for experimenting with it, Kaf. =)

    How would I go about it if my blog was already on a subdomain?


  4. Kafkaesqui

    Posted 10 years ago #

    My blog is hosted on a subdomain to my main site, so there should be no real difference in how you'd set things up. Sub-domains, in most cases and as far as PHP is really concerned, are mere directories on a hosted account. For me it works like this: I have a subdirectory for my main site (www), and one for my blog's subdomain (guff). To provide the full directory path on the server to my blog's directory and wp-blog-header.php, I changed


    in the various syndication files to


    It's all about starting the path from the root of the server. From there you just need to provide the rewrite rules, unless you have no problem pointing directly to wp-feed.php or the feed-specific files.

  5. Yeah, I think that's the problem, too. Since my blog is on a subdomain, and I'd like the RSS feeds to be on a subdomain as well, I don't think I can provide the full directory path. That first forward slash would start at the root - of the subdomain folder.

    I tried what you instructed:

    • uploaded wp-atom.php, wp-rss.php, and wp-rss2.php to xml.btvillarin.com
    • changed the full directory path to require('/blogged/wp-blog-header.php');

    That gave me a 404.

    Can you try it for me, not from your main site (www.szub.net) but on a subdomain like myself (xml.szub.net)?

  6. Kafkaesqui

    Posted 10 years ago #

    I could try it, but A. the new subdomain wouldn't be valid for a bit, and B. I can already tell you it will work.

    Here's a better idea--copy the following 3 lines into a blank text file (no spaces or lines above or below it):

    echo dirname(__FILE__);

    Save it and call the file "dir.php". Upload this to your blog's main directory, that is where wp-blog-header.php resides. Then access it from your browser. Use the path it displays to point to your wp-blog-header.php file.

  7. Sweet! So far, these work:


    The rewrite rules didn't work, though. I just put in those two lines, and no dice - 404.

    (I really appreciate this, Kaf.)

  8. Kafkaesqui

    Posted 10 years ago #

    RE: 404 Error

    Make sure before starting your rewrite rules in .htaccess you have:

    RewriteEngine On

  9. That's it, I'm good to go! You're the man, Kaf...you are the man!

    I'll write this on my blog (or in the Codex) if someone wants to do the same. I'm stoked, man. Thanks a bunch!

  10. Doh, there's more. What/which file(s) need to be uploaded for the comments RSS feed to work? So far, I've uploaded:

    • wp-atom.php
    • wp-commentsrss2.php
    • wp-feed.php
    • wp-rdf.php
    • wp-rss.php
    • wp-rss2.php

    Linking directly to wp-commentsrss2.php works, but the nice URL doesn't.

  11. Kafkaesqui

    Posted 10 years ago #

    Those should do it. *For comments, especially on individual posts, you're going to need to copy and modify whatever rewrite rules you have for your comments feed. Could get a bit hairy here, so let me look over what's needed and get back to you.

    And I commented on your blog about this, but for future xml'ers:

    Don't forget to change the <link> tags in the header template (i.e. header.php), or the <head> element wherever it's located in your theme's templates, to point to your new feed urls. That is, if you currently have your feed urls in <link> tags. If not, skip this step.


  12. Thanks, I forgot to update those, too... *phew*

    404: http://xml.btvillarin.com/comments/feed/

  13. Hey Kaf, also, how would you go about redirecting everybody from the old feeds to the new ones automagically? (You know, for those who forget to change them.)

  14. I didn't see your edit, so okay - thanks again, Kafkaesqui! Oh yeah, and if you can't figure it out, it's not a problem. If it makes you feel any better, Matt doesn't have any links to any comment feeds for his syndication subdomain - because he didn't setup any! ;)

  15. jwlyrio
    Posted 8 years ago #

    Hi all,

    I'm a newbie to WordPress but I'm learning very quickly.

    I'm trying to get my rss feed up and running. It was working fine when my blog's address was http://www.lyrio.com/blog/ but I've switched it to http://cafe.lyrio.com/ and now nothing.

    I've tried to make the changes to the syndication files using the methods outlined above but no luck.

    I'm not seeing the string:
    "require('./wp-blog-header.php');" anywhere in my syndication files.

    I do see:
    "if (empty($wp)) {

    Which I changed, but no luck.

    Has this changed with the new WordPress 2?

    Any help would be greatly appreciated.

  16. rudolfnu
    Posted 8 years ago #

    you can also try this plugin:
    You have the option to redirect feed direct to Feedburner!

  17. I'm trying to get my rss feed up and running. It was working fine when my blog's address was http://www.lyrio.com/blog/ but I've switched it to http://cafe.lyrio.com/ and now nothing.

    I don't see the problem. Your feed appears to work fine.

    See it here: http://cafe.lyrio.com/feed/

    WordPress has feeds built in. There is nothing special that you need to do.

  18. jwlyrio
    Posted 8 years ago #

    I see that, however when I try to add my RSS feed (to Google Homepage, for example) is does not work. I get the message "Not Found: http://cafe.lyrio.com/wp-rss2.php."

    I can't seem to get the feed to come up anywhere else either.

    It worked just fine when I was running the blog under http://www.lyrio.com/blog/

    Any idea what's going on here?

  19. jwlyrio: I was able to add your feed to my Google Homepage just fine. All I did was click the "Add a URL" link and then added the URL of http://cafe.lyrio.com/feed/ . I don't know why you're trying to link to wp-rss2.php, but it's not necessary. Your feed works perfectly. Stop messing with it. :)

  20. jwlyrio
    Posted 8 years ago #

    Got it! Sorry, newbie here obviously. Thanks so much!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.