除了某些Feed之外,如何将主要所有Feed重定向到feedburner?

时间:2012-07-28 00:26:39

标签: wordpress apache mod-rewrite feedburner

我想将博客的主要Feed重定向到feedburner,但我不想重定向其他Feed,例如: mywordpressblog.ir/feed/?post_type=post 要么 mywordpressblog.ir/feed/?post_type=daily

我已经以这种方式配置了apache .htaccess,但它不起作用!任何人都可以帮助我吗?

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteCond %{REQUEST_URI} !^/feed/\?post.*$ [NC]
RewriteRule ^(.*)$ http://feeds.khajavi.ir/khajavi  [R=302,NC,L]
</IfModule>


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

1 个答案:

答案 0 :(得分:1)

您无法与%{REQUEST_URI}中的查询字符串匹配,您需要使用%{QUERY_STRING} var:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteCond %{REQUEST_URI} !^/feed/ [NC]
RewriteCond %{QUERY_STRING} !^post
RewriteRule ^(.*)$ http://feeds.khajavi.ir/khajavi  [R=302,NC,L]