Redirecting WordPress category feeds containing non-latin characters to Feedburner

Today I was playing with my feeds. I wanted to redirect the category feeds to feedburner. I couldn’t find any plugin that can do the job well because a have a lot of categories and had to create manually a feed in feedburner for each of them. The main problem is that I have multilingual content and my categories have slugs in Bulgarian. Upto now I had feedburner feeds just for the whole content on the blog in Bulgarian and English. I am using .htaccess that redirects my feeds to feedburner like this:

# bg feeds
RewriteCond %{HTTP_USER_AGENT} !^(FeedBurner|FeedValidator) [NC]
RewriteRule ^bg/feed/?$ http://feeds.feedburner.com/Georgibudinovcom [R=302,NC,L]

# en feeds
RewriteCond %{HTTP_USER_AGENT} !^(FeedBurner|FeedValidator) [NC]
RewriteRule ^feed/?$ http://feeds.feedburner.com/budinov/hSZI [R=302,NC,L]

But now I had to include the category matching which has non-latin characters. This would not work so I had to do it via PHP. I then realized that the same thing can be achieved with the help of one of those plugins for redirects in WordPress. However this is the better way for me. Here it is:

fp-includes/feeds.php

$configRedirects = array(
 '/bg/category/програмиране/feed/' => 'http://feeds.feedburner.com/budinov/HjOF',
 '/bg/category/програмиране/php-програмиране/feed/' => 'http://feeds.feedburner.com/budinov/okdt',
 '/bg/category/програмиране/php-програмиране/codeigniter-php/feed/' => 'http://feeds.feedburner.com/budinov/KATe',
 '/bg/category/програмиране/php-програмиране/prado-php/feed/' => 'http://feeds.feedburner.com/budinov/Dhjv',
 '/bg/category/програмиране/php-програмиране/wordpress-php-програмиране/feed/' => 'http://feeds.feedburner.com/budinov/rfxC',

 '/category/programming/feed/' => 'http://feeds.feedburner.com/GeorgibudinovcomProgramming',
 '/category/programming/php/feed/' => 'http://feeds.feedburner.com/GeorgibudinovcomPhp',
 '/category/programming/php/codeigniter/feed/' => 'http://feeds.feedburner.com/GeorgibudinovcomCodeigniter',
 '/category/programming/php/prado/feed/' => 'http://feeds.feedburner.com/GeorgibudinovcomPrado',
 '/category/programming/php/wordpress/feed/' => 'http://feeds.feedburner.com/GeorgibudinovcomWordPress',
);

$decodedUrl = urldecode($_SERVER['REQUEST_URI']);

if(!eregi("FeedBurner|FeedValidator", $_SERVER['HTTP_USER_AGENT']) && $configRedirects[$decodedUrl])
{
 header('Location: '.$configRedirects[$decodedUrl]);
 die();
}

This post is also available in: Bulgarian

  1. Both S Voice and Moto Voice have the ability to set up your own custom hotwords for detection. This is a lot of fun because if you’re just using Google Now then you are stuck with using ‘OK Google’ as your hotword.

  2. It would then have to create an FBI forensics laboratory on site at its headquarters and staff it. The burden would then extend to what Apple views is the inevitable onslaught of additional devices that would follow after the precedent was set.

  1. No trackbacks yet.