IIS 301 Redirection While Preserving the Query String

October 31, 2008
No Comments.

Url: http://www.developerfusion.com/code/4678/perman…
Silverlight Logo
Someone off the topic, in moving from ADOGuy.com to Wildermuth.com I used IIS’s trick of a permanent redirection to point old links to the new site and this seemed to work…kinda…sorta.

Very old links to ADOGuy.com (before I used blog URL’s that were friendlier) took the form of “/Content.aspx?id=rantview&rantid=317” which I had code to redirect automatically to the right rant. But…

The IIS redirection was truncating the query string. I googled my head off and was begging people on Twitter for a non-code fix (I could have written a handler, but I was hoping IIS could do it for me).  That’;s when I ran into this great post that fixed it for me!

The trick (which you can read on DeveloperFusion’s blog entry) is to check “A permanent redirection for this resoruce”, click “The exact URL entered above” and add a $S$Q to the end of the URL so that the subdirectory and query string are appended as shown below in IIS 6:

Cool, huh?  Too bad its not documented better.