In IIS there is a trick for redirecting requests to a new URL including original path and query string. This trick worked on IIS 6. Today I tried this with IIS 7.5 on Windows Server 2008 R2. It’s still working!!!
Demo:
1. You have an SharePoint with host header “sharepoint.local” and a Shared Documents library with a single document. This link will open the document properties view form:
2. Now you create a IIS redirect for “http://sharepoint-redirect.local”:
Therefore you create a new web application in IIS:
Now you add “Http Redirect” functionality to the web application:
Click “Apply” after configuration.
3. If you test it in the browser with URLs like http://sharepoint-redirect.local/Shared%20Documents it works as expected. You get http://sharepoint.local/Shared%20Documents
4. But if you try the link from above you get an unexpected result:
redirected to:
5. If you uncheck (and “Apply”) the following checkbox in the HTTP Redirect settings of the web application it looks a little bit better:
redirected to:
http://sharepoint.local/Shared%20Documents/Forms/DispForm.aspx
The URL is correct but the query string is missing. So the form is empty:
6. Now the “old” IIS trick for HTTP Redirect:
Use tokens $S$Q in the redirect URL!
$S = Path
$Q = Query String
Now it HTTP Redirect works as expected!
redirected to: