How to redirect main all feed to feedburner except some feeds?

Deadly 提交于 2019-12-25 01:49:04

问题


I want to redirect main feed of my blog to feedburner but I don't want to redirect other feeds like: mywordpressblog.ir/feed/?post_type=post or mywordpressblog.ir/feed/?post_type=daily

I have configured the apache .htaccess in this way, but it doesn't work! Any one could help me?

<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:


You can't match against the query string in the %{REQUEST_URI}, you need to use the %{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]


来源:https://stackoverflow.com/questions/11697192/how-to-redirect-main-all-feed-to-feedburner-except-some-feeds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!