{"id":81,"date":"2008-04-08T20:09:39","date_gmt":"2008-04-09T01:09:39","guid":{"rendered":"http:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/81"},"modified":"2008-04-08T20:09:39","modified_gmt":"2008-04-09T01:09:39","slug":"dirt-simple-301-redirect-on-shared-hosting-and-the-404-trick","status":"publish","type":"post","link":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/81","title":{"rendered":"Dirt Simple 301 Redirect on Shared hosting and the 404 trick."},"content":{"rendered":"

I’m using a shared hosting account for my web site. I have no control over the file types (extensions) that are handled by ASP.NET — only the standard file extensions (ASPX, ASMX, etc.) are supported. By request, I was asked to make my old RSS and Atom XML file feeds up to date with my new blog posts. During the transitions I’ve made, I may have lost some subscribers as I hadn’t kept them up to date as much as I would have liked. <\/p>\n

So, with a wave of the magic ASP.NET wand and a little 404 magic, the two XML files are now serving up content from my new WordPress installation. On my web host, I can modify what pages handle 404 web server errors (file not found). I changed the setting to point to a new ASPX file, appropriately named, 404.aspx. Here’s what it contains:<\/p>\n

<%<\/span>@ <\/span>Page <\/span>Language<\/span>=\"C#\" <\/span>%>\n<%\n<\/span>    string <\/span>qstr = HttpUtility<\/span>.UrlDecode(Request.QueryString.ToString());\n\n    if <\/span>(qstr.Contains(\"index.xml\"<\/span>) || qstr.Contains(\"atom.xml\"<\/span>))\n    {\n        string <\/span>movedTo = \"http:\/\/feeds.feedburner.com\/wiredprairie\"<\/span>;\n        Response.Status = \"301 Moved Permanently\"<\/span>;\n        Response.AddHeader(\"Location\"<\/span>, movedTo);\n        Response.End();\n\n        return<\/span>;\n    }\n\n    Response.Status = \"404 Not Found\"<\/span>;        \n    Response.End();\n\n    return<\/span>;\n%><\/span><\/pre>\n

<\/a>I grab the query string which minimally contains the requested Url, and if it’s either atom.xml or index.xml, I redirect to the FeedBurner location for the RSS<\/a> feed. If it wasn’t one of those files, I just return a 404 error and quit (as I don’t have a custom 404 page developed).<\/p>\n

Of course, with a bit more robust coding, this could handle a wider variety of cases and redirect to far more web pages. Or, you can just point to my RSS feed. :)<\/p>\n","protected":false},"excerpt":{"rendered":"

I’m using a shared hosting account for my web site. I have no control over the file types (extensions) that are handled by ASP.NET — only the standard file extensions (ASPX, ASMX, etc.) are supported. By request, I was asked to make my old RSS and Atom XML file feeds up to date with my […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[4],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pd5QIe-1j","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":388,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/388","url_meta":{"origin":81,"position":0},"title":"Silverlight Weather Demonstration","date":"June 26, 2008","format":false,"excerpt":"Demonstration available here. (You'll need to wait for a moment while it loads the first time). I've created a reasonably simple, yet multi-technology (and discipline) demonstration using Silverlight for the user interface and ASP.NET as the back-end. The demonstration uses: Silverlight 2.0 Data binding Delayed downloading of images \"Web services\"\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2008\/06\/image21.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":331,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/331","url_meta":{"origin":81,"position":1},"title":"Velocity — a rockin’ distributed in memory cache for ASP.NET","date":"June 3, 2008","format":false,"excerpt":"Velocity, the code-name for a new in-memory distributed caching system for ASP.NET was released as a Community Tech Preview today. What is it? It's described in the documentation: Microsoft project code named \"Velocity\" provides a highly scalable in-memory application cache for all kinds of data. By using cache, your application\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2008\/06\/image-thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":217,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/217","url_meta":{"origin":81,"position":2},"title":"The ASP.NET Single Page Interface and AJAX Patterns","date":"May 9, 2008","format":false,"excerpt":"Posted on MSDN, by Dino Esposito, \"Single Page Interface and AJAX Patterns.\" What is it? From the article... Single-Page Interface Model To take full advantage of AJAX, you need to have all of your features, or at least most of them, in a single page. This is known as the\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":458,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/458","url_meta":{"origin":81,"position":3},"title":"JavaScript ASP.NET Data Templates (or, I was missing Data Templates in Silverlight …)","date":"August 11, 2008","format":false,"excerpt":"After you taste Data Templates in Silverlight and WPF, you won't want to go back to your old way of building user interfaces. I mean seriously, do you like the idea of building a user interface by custom drawing a list box using various owner-drawn techniques like exist in Win32?\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2008\/08\/image-thumb1.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":426,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/426","url_meta":{"origin":81,"position":4},"title":"Visual WebGUI — Uh? Neat technology for someone else.","date":"July 16, 2008","format":false,"excerpt":"At the top of the page linked above, you can try the Ajax version or the Silverlight version of their web-mail demo. Try it. I won't say that I'm not impressed by what they've accomplished technically. It's impressive. They use a WinForms designer to build parts of the user interface\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2008\/07\/image-thumb2.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1442,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1442","url_meta":{"origin":81,"position":5},"title":"Nest Thermostat API\/Protocol","date":"January 8, 2012","format":false,"excerpt":"While Nest Labs hasn\u2019t released a formal (documented & supported) API, I thought I\u2019d do a bit of digging to see how they\u2019re using the network and what might be achievable. A few things are going on, the majority as you\u2019d probably expect. The web interface is using a long\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2012\/01\/image_thumb7.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/81"}],"collection":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/comments?post=81"}],"version-history":[{"count":0,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/81\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}