Setup a redirection in IIS with parameters carried over

10,664

If you set the $Q flag in the redirect URL, the request/query parameters should be included in the redirect from the original. If you don't want the question mark to be included in the redirect URl, then use $P instead.

examples:
using $Q:
Original URL: http://startingURL?param1=1&param2=2
Redirect URL: https://newURL$Q
Resulting URL: https://newURL?param1=1&param2=2

using $P:
Original URL: http://startingURL?param1=1&param2=2
Redirect URL: https://newURL$P
Resulting URL: https://newURLparam1=1&param2=2

For additional reading, take a look at the TechNet article: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/41c238b2-1188-488f-bf2d-464383b1bb08.mspx?mfr=true

Share:
10,664
FBryant87
Author by

FBryant87

Updated on June 04, 2022

Comments

  • FBryant87
    FBryant87 almost 2 years

    If I have a website like the following:

    https://xxx/section1/
    https://xxx/section2/
    https://xxx/section3/
    

    But users may also access the URLs with parameters:

    https://xxx/section1/&p=1494943
    

    I'm going to create a seperate site in IIS6 which will redirect any HTTP requests to the HTTPS website:

    request: http://xxx/
    redirected to: https://xxx/
    

    And in the same sense:

    request: http://xxx/section2/&p=1474724
    redirected to: https://xxx/section2/&p=1474724
    

    My question is, how can I ensure they are redirected to the correct section and still carry over the parameters?

    Thank you very much for your help.