IIS and redirecting a page with a Query String

Microsoft has added to the redirect function in IIS to allow for Query Strings.

Example:
In the Redirect to box, enter the domain you wish to move to (no trailing slash), plus $S$Q – for example, http://www.tek-works.com$S$Q

What does this $S$Q do? These are tags that IIS will automatically replace – $S will be replaced with the subdirectory location (such as /shopping/cart.aspx) and $Q will be replaced with the querystring (such as ?id=Blue).

$P Passes parameters that were passed to the URL to the new URL. If the request contains parameters such as http://www.oldsite.com/cart.asp?id=Blue , then $P would represent all the values after the question mark in the URL, example $P would equal id=Blue (no question mark).

$Q Passes the parameters including the question mark. This is the same as $P but includes the question mark or query string. So $P would equal ?id=Blue

$S Passes the matching suffix of the URL to the new URL. If the request is for http://www.oldsite.com/shopping/cart.asp, then $S represents /cart.asp. If the request was for http://www.oldsite.com/shopping then the value of $S would be /shopping

$V Removes the server name from the original request. If the request is for http://www.oldsite.com/shopping/cart.asp then $V would contain everything after the server name, eg: /shopping/cart.asp.

* Wildcard symbol used for replacement. Let’s say you want to redirect all requests for html pages to a single asp page – you could do so in the following way: *;*.htm;page.asp

Technorati Tags: ,

     

Leave a Reply