I'm gonna break this tutorial into two parts. The first part is when you want to move an RSS feed to another place, domain, blog, or whatever. The second part is when you don't care anymore and you want your readers to simply go away and free up some bandwidth.
Moving an RSS Feed
In doing my own testing, I put together a very dynamic RSS feed [https://rssweblog.com/test/rss-time.aspx] where all these various move operations will be moving to. The first and most proper way of moving an RSS feed is to respond to the HTTP request with a 301 Permanent Redirect. I've prepared a small ASPX file [https://rssweblog.com/test/http-301.aspx] that simulates exactly this type of response. The code for ASP.NET is shown.
<%@ page language="C#" %>
<%
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","https://rssweblog.com/test/rss-time.aspx");
%>
If you re-use this code, simply change the URL in the AddHeader call to the target URL where your RSS feed is moving to.
For the really geeky nerds out there, this is what a 301 redirect looks like at the wire level. The first two lines are the client request and the last four are the server response. I removed a couple headers that were irrelevant to the discussion.
GET /rss/test/http-301.aspx HTTP/1.1 Host: www.kbcafe.com HTTP/1.1 301 Moved Permanently Date: Fri, 10 Nov 2006 17:55:11 GMT Location: https://rssweblog.com/test/rss-time.aspx Content-Length: 0
Of course, not everybody has HTTP level access to their website or the skill required to generate such a response. In those cases, you may want to consider an XML-level redirect. Here's a sample XML-level redirect [https://rssweblog.com/test/xml-redirect.xml]. The content of the file is shown below.
<?xml version="1.0" ?>
<redirect>
<newlocation>https://rssweblog.com/test/rss-time.aspx</newlocation>
</redirect>
To use this technique simply download the xml-redirect.xml file. Then change the URL of the target RSS feed to the URL where your RSS Feed is moving to. You may have to escape some characters in your target URL. Change > to > < to < and & to &. If you struggle with such escaping, then drop me an email [randy@kbcafe.com]. Finally, rename the file to the same filename as your RSS feed and copy the file to your web server, replacing your old RSS file.
Again for the geekoids, here's what the XML-redirect looks like on the wire.
GET /rss/test/xml-redirect.xml HTTP/1.1 Host: www.kbcafe.com HTTP/1.1 200 OK Content-Length: 121 Content-Type: text/xml Last-Modified: Fri, 10 Nov 2006 16:21:37 GMT Accept-Ranges: bytes ETag: "2268c84be44c71:d84" Date: Fri, 10 Nov 2006 17:57:19 GMT <?xml version="1.0"?> <redirect> <newLocation>https://rssweblog.com/test/rss-time.aspx</newLocation> </redirect>
Assuming options A and B are not possible, the next best way is a 302 Temporary Redirect. But this method is really wasteful because the client software will continue to use the original URL and be redirected every-time to the new URL. Wasteful indeed. Here's sample temporary redirect [https://rssweblog.com/test/http-302.aspx]. If all of A, B and C are not possible, then a last option is to put a blog entry that specifically asks your readers to re-sub using the new URL.
Retiring an RSS Feed
Great, we know how to move an RSS feed, but just how do we go about killing one that is no longer required. The best way to tell a client that a feed is no longer used is to response with a HTTP 410 Gone response. Here's a sample 410 gone response [https://rssweblog.com/test/http-410.aspx].
The ASP.NET code for a 410 gone response.
<%@ Page Language="C#" %>
<%
Response.Status = "410 Gone";
%>
And here's what it looks like on the wire.
GET /rss/test/http-410.aspx HTTP/1.1 Host: www.kbcafe.com HTTP/1.1 410 Gone Date: Fri, 10 Nov 2006 18:02:32 GMT Content-Length: 0
Some RSS clients will prompt the user to remove the feed when this response is encountered. Others will simply stop polling the feed or even unsubscribe the user without requiring any confirmation.
If you can't figure out how to do a 410 Gone response, then you can also use an XML-level redirect to accomplishes the same. Here's a sample XML-level redirect that tells the RSS client that the feed should be unsub'ed [https://rssweblog.com/test/xml-gone.xml]. Note this XML-level redirect is similar to previous, except that no new RSS feed is provided.
<?xml version="1.0"?>
<redirect>
<newLocation/>
</redirect>
And finally, here's what a XML-level unsub looks like on the wire.
GET /rss/test/xml-gone.xml HTTP/1.1 Host: www.kbcafe.com HTTP/1.1 200 OK Content-Length: 64 Content-Type: text/xml Last-Modified: Fri, 10 Nov 2006 16:21:37 GMT Accept-Ranges: bytes ETag: "de1aba4be44c71:d84" Date: Fri, 10 Nov 2006 18:10:18 GMT <?xml version="1.0"?> <redirect> <newLocation/> </redirect>
Notes: If anybody has PHP code or other similar to the ASP.NET code above, then feel free to post them in the comments. If you post them in the next few days, then I'll likely add them to the content of the original article. And a big thanks in advance.
Accumulating much producing technology, Moncler Jackets have been popularized in many areas. |