.htaccess 重定向_如何使用.htaccess将Feed链接重定向到follow.it

.htaccess 重定向

Feedburner used to a powerful tool for RSS feeds publishing and subscriber management. However, feedburner will unlikely leave its maintenance mode because there has been no new features yet less features for quite some years. But RSS feed is still an important part of the Web supported by many software such as WordPress. follow.it is one of the good alternatives for managing the RSS feeds.

Feedburner曾经是RSS订阅源发布和订户管理的强大工具。 但是,feedburner不太可能会退出其维护模式,因为多年来没有新功能,但功能却很少。 但是RSS提要仍然是许多软件 (如WordPress)支持的Web的重要组成部分。 follow.it是管理RSS feed的不错选择之一。

The post How to Redirect WordPress Feed to Feedburner Using .htaccess introduces how to redirect WordPress RSS feed to feedburner using the powerful .htaccess. Let’s look at how to use .htaccess to redirect feed URLs to follow.it in this post. The method is based on .htaccess so it is content management software neutral and many software like WordPress can be supported.

如何使用.htaccess将WordPress提要重定向到feedburner的文章介绍了如何使用功能强大的.htaccess将WordPress WordPress提要重定向到feedburner。 让我们看看本文中如何使用.htaccess将供稿URL重定向到follow.it。 该方法基于.htaccess,因此它是内容管理软件中立的,并且可以支持许多软件,如WordPress。

Let’s use <site domain>/feed?.* (? means one character (like /) and .* means any string) as an example as the original URL. Now we redirect it to follow.it URL https://follow.it/systut .

让我们以<site domain>/feed?.*?表示一个字符(如/.*表示任何字符串))作为原始URL作为示例。 现在我们将其重定向到follow.it URL https://follow.it/systut

The idea is: for every request to the URL, first check whether the HTTP_USER_AGENT is from follow.it by matching the HTTP_USER_AGENT string. If HTTP_USER_AGENT matches the follow.it keyword, do nothing so that the feed content will be returned to the follow.it requester. Otherwise, redirect the request to the follow.it URL since it is from a normal users’ browsers or some feed readers. Through this method, the normal user can read the feeds from follow.it, while follow.it can get the original feeds content from the website.

这个想法是:对于每个对URL的请求,首先通过匹配HTTP_USER_AGENT字符串来检查HTTP_USER_AGENT是否来自follow.it。 如果HTTP_USER_AGENT与follow.it关键字匹配,则不执行任何操作,以便将提要内容返回给follow.it请求者。 否则,将请求重定向到follow.it URL,因为它来自普通用户的浏览器或某些提要阅读器。 通过这种方法,普通用户可以从follow.it读取提要,而follow.it可以从网站获取原始提要内容。

The method
Add these codes to the beginning of the .htaccess file in the directory of the site directory / (because /feed is under /; use different directory according to the site software and path structure):

方法
将这些代码添加到站点目录/的目录中.htaccess文件的开头(因为/feed/下;根据站点软件和路径结构使用其他目录):

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_URI}      ^/feed        [NC]
 RewriteCond %{HTTP_USER_AGENT} !^.*(https://follow.it)          [NC]
 RewriteRule ^feed?.*$          http://follow.it/systut  [L,NC,R=302]
</IfModule>

Then you may test it using follow.it and using your own browser to verify that different agents get different content.

然后,您可以使用follow.it并使用您自己的浏览器对其进行测试,以验证不同的代理获得了不同的内容。

翻译自: https://www.systutorials.com/how-to-redirect-feed-links-to-follow-it-using-htaccess/

.htaccess 重定向

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值