- Download the URL Rewrite tool by following the instructions here
- Ensure that the IIS site you are using is configured for the proper port 80 binding.
- Create a new URL rewrite rule. Select “Blank rule” and click “OK”
- Set a Name and rule settings exactly as follows -Redirect t
- Match URL:
- Requested URL: Matches the Pattern
- Using: Wildcards
- Pattern:
*
- Check “Ignore case”
- Add Condition:
- Condition input:
{HTTPS}
- Check if input string: Matches the Pattern
- Pattern:
off
- Check “Ignore case”
- Leave Server Variables section blank
- Add Action:
- Action type: Redirect
- Redirect URL:
https://{HTTP_HOST}{REQUEST_URI}
- Check “Append query string”
- Redirect type: Found (302)
Note: In this example {HTTPS}, {HTTP_HOST}, and {REQUEST_URI} are all URL parts that can be accessed using the URL Rewrite module.
For example, if a request was made for this URL: http://www.mysite.com/content/default.aspx?tabid=2&subtabid=3, and a rewrite rule was defined on the site level then:
- The rule pattern gets the URL string
content/default.aspx
as an input. - The QUERY_STRING server variable contains
tabid=2&subtabid=3
. - The HTTP_HOST server variable contains
www.mysite.com
. - The SERVER_PORT server variable contains
80
. - The SERVER_PORT_SECURE server variable contains
0
and HTTPS contains OFF
. - The REQUEST_URI server variable contains
/content/default.aspx?tabid=2&subtabid=3
. - The PATH_INFO server variable contains
/content/default.aspx
.
More information on URL parts can be found here.