Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Im using Feedburner and have my WordPress feeds redirected. I want to add an exception for the Yahoo Pipes 2.0 user agent but the user agent string contains spaces. When I put quotes around it I get an apache config test fail.

Here are the rules.

# BEGIN Feedburner
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(feed|wp-atom|wp-feed|wp-rss|wp-rdf|wp-commentsrss)(.+)\ HTTP/ [NC,OR]
RewriteCond %{QUERY_STRING} ^feed [NC]
RewriteCond %{HTTP_USER_AGENT} !^(FeedBurner|FeedValidator) [NC]
RewriteCond %{HTTP_USER_AGENT} !^"Yahoo Pipes 2.0" [NC]
RewriteRule .* http://feeds.feedburner.com/xxxxxxx [R=307,L] 
</IfModule>
# END Feedburner

Here is the error I get when I try to reload apache. Also the rules are in the vhost because I am using WordPress multi site and if I put it in .htaccess all my sites feeds would be redirected to this sites Feedburner.

Syntax error on line 46 of /etc/apache2/sites-enabled/xxxxxxx:
RewriteCond: bad flag delimiters
Action 'configtest' failed.
The Apache error log may have more information.
 failed!
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I figured it out and I am leaving the answer here.

The HTTP_USER_AGENT condition checks for a match of any of the words so I only needed to add Yahoo instead of "Yahoo Pipes 2.0".

The correct rules are:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(feed|wp-atom|wp-feed|wp-rss|wp-rdf|wp-commentsrss)(.+)\ HTTP/ [NC,OR]
RewriteCond %{QUERY_STRING} ^feed [NC]
RewriteCond %{HTTP_USER_AGENT} !^(FeedBurner|FeedValidator|Yahoo) [NC]
RewriteRule .* http://feeds.feedburner.com/xxxxxxx [R=307,L] 
</IfModule>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.