WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Manually edit WP's .htaccess file (for rss feed redirect) (6 posts)

  1. rubzie
    Member
    Posted 8 years ago #

    How can I edit my .htaccess file without WP 1.5.1.2 undoing my editing?

    I want to 301 redirect my feeds to a feedburner feed, so subscribers dont have to change their url (And so I keep in control of my feed url if i ever stop using feedburner). But when I edit the .htaccess and I post something, the changes are undone.

    I prefer not to use an xml redirect in the rss unless I really have to. TIA for any suggestions, finding an answer is hard because there are so many other .htaccess related posts :o

  2. lynk
    Member
    Posted 8 years ago #

    One way is to edit the core file that writes the htaccess.
    That is classes.php in wp-includes/.

    line 1213 starts

    function mod_rewrite_rules()
    {
    [...]

    $rules = "<IfModule mod_rewrite.c>\n";
    $rules .= "RewriteEngine On\n";
    $rules .= "RewriteBase $home_root\n";

    $rules .= "Your rule here"\n";

    [...]
    ]

  3. I've done exactly that: http://www.viper007bond.com/feed/

    I did it by editing my .htaccess file and adding the following BEFORE "# BEGIN WordPress":

    RewriteRule ^feed/?$ http://feeds.feedburner.com/viper007bondcom-rss2 [QSA,L]
    RewriteRule ^feed/rss2/?$ http://feeds.feedburner.com/viper007bondcom-rss2 [QSA,L]
    RewriteRule ^feed/rss/?$ http://feeds.feedburner.com/viper007bondcom-rss [QSA,L]
    RewriteRule ^feed/atom/?$ http://feeds.feedburner.com/viper007bondcom-atom [QSA,L]
    RewriteRule ^feed/rdf/?$ http://feeds.feedburner.com/viper007bondcom-rdf [QSA,L]
    RewriteRule ^rss2/?$ http://feeds.feedburner.com/viper007bondcom-rss2 [QSA,L]
    RewriteRule ^rss/?$ http://feeds.feedburner.com/viper007bondcom-rss [QSA,L]
    RewriteRule ^atom/?$ http://feeds.feedburner.com/viper007bondcom-atom [QSA,L]
    RewriteRule ^rdf/?$ http://feeds.feedburner.com/viper007bondcom-rdf [QSA,L]
    RewriteRule ^somestringoftext/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1 [QSA,L]

    Replace somestringoftext with some random string of text and give those URLs to feed burner (yoursite.com/somestringoftext/rss2, rss, etc.). That'll allow Feedburner to still get a copy of your feed.

  4. lynk
    Member
    Posted 8 years ago #

    just one correction regarding my post:

    $rules .= "Your rule here"\n"; WRONG
    $rules .= "Your rule here\n"; CORRECT

  5. rubzie
    Member
    Posted 8 years ago #

    Thanks a lot guys (or gals), editing that class of code would've probably been my solution. And still might be for erroneous posts and other manual redirects :o (although i bet i'll find a plugin for that too)
    But i stumpled upon another solution yesterday, reading these about redirecting to feedburner:
    WordPress Feedburner Plugin and
    Hard lessons learned with Feedburner and Bloglines

    It works fine so far, results in Dutch can be viewed at Usarchy usability nieuws.

  6. Yeah, but "WordPress Feedburner Plugin" only does 1 feed. I wanted each of my feed formats to go to their respective Feedburner feed. ;)

Topic Closed

This topic has been closed to new replies.

About this Topic