Forum Moderators: phranque
I have a bilingual blog with a feed for each language.
I would like to redirect each feed to a feedbmurner URI but I don't know how to deal with the question mark nor how to have all rules working together.
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT}!FeedBurner
RewriteRule ^index\.php/bilingual/feed/?lang=en$ http://feeds.feedburner.com/myblog-en [R=302,L]
RewriteRule ^index\.php/bilingual/feed/?lang=fr$ http://feeds.feedburner.com/myblog-fr [R=302,L]
What do you want to do with the question mark? It delimits the query string from the URL. Do you want/need to pass the query string to the feedburner URL? I doubt it, but I don't know anything about your project...
> nor how to have all rules working together.
How do they or do they not work together now? How have you tested? What were the results? How did those results differ from your expectations?
Why are you testing the User-agent to see if it's not Feedburner?
Are you aware that a RewriteCond only applies to the single RewriteRule that follows it? This means that you may need to duplicate the RewriteCond or structure your code differently if both rules need to be qualified by the requesting User-agent.
Jim
> Do you want/need to pass the query string to the feedburner URL?
No need, it's just that the question mark is breaking the rule.
> Why are you testing the User-agent to see if it's not Feedburner?
Because I want to use Feedburner while keeping people subscribed to my own URI.
> Are you aware that a RewriteCond only applies to the single RewriteRule that follows it?
No that is what I meant by working together, I just want the code to be as compact as possible.
[edited by: eSite at 10:15 pm (utc) on Aug. 28, 2006]
RewriteEngine on
#
RewriteCond %{HTTP_USER_AGENT} !FeedBurner
RewriteCond %{QUERY_STRING} ^lang=(en¦fr)$
RewriteRule ^index\.php/bilingual/feed/$ http://feeds.feedburner.com/myblog-%1? [R=302,L]
Replace the broken pipe "¦" character above with a solid pipe character before use; Posting on this board modifies that character.
Jim