Support » Fixing WordPress » How to redirect RSS feeds to a subdomain?

  • 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?

Viewing 15 replies - 1 through 15 (of 19 total)
  • 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).

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

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

    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.

    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
    • 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 ( but on a subdomain like myself (

    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.

    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.)

    RE: 404 Error

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

    RewriteEngine On

    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!

    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.

    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.


    Thanks, I forgot to update those, too… *phew*


    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.)

    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! 😉

    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 but I’ve switched it to 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.

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

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘How to redirect RSS feeds to a subdomain?’ is closed to new replies.