Thoughts, Code, Other

Technical blog of Nik Smit

rainbow

IIS Redirect with Query String

Wow, a very long time since my last post. The vagaries of being heavily involved in a project! The upside is that one picks up loads of new knowledge with each different application you write.

Quick IIS tip

One can set up a website in IIS to redirect to another quite easily. This is useful in a variety of scenarios. However, the UI doesn't give you a way to include the path and querystring.

So if your original url was :

http://olddomain.com/Example?id=2134

the best you'll get after is :

http://newdomain.com/MyExplicitRedirectLocation

Which is only useful in a fraction of scenarios.

To get the path and querystring, append "$S$Q" (no quotes) to your target URL, and check the box "redirect all requests to exact location".

This will translate your incoming url to :

http://newdomain.com/Example?id=2134

which is probably what you want.

One Response to “IIS Redirect with Query String”

  1. January 15th, 2009 at 5:42 pm

    vinh says:

    thanks a lot.