Automatically Redirect HTTP requests to HTTPS on IIS 7 using URL Rewrite


To automatically redirect HTTP request to HTTPS on a IIS server, you will need to perform the following steps. First make sure that the website has both ports configured in the binding section, just like in the following example:

Web server bindings

Now select the website and click on URL Rewrite section from the menu:

URL rewrite module
Click on Add Rule(s) from the right section of the panel and create a Blank rule:
Windows Server 2008 URL rewrite
Set a name for the inbound rule and configure the pattern to (.*)
IIS URL rewrite
In the Conditions section press Add and set the following:
Condition input : {HTTPS}
Type: Matches the Pattern
Pattern: ^OFF$
Redirect HTTP requests to HTTPS
In the Action menu configure the following:
Redirect HTTP requests to HTTPS on IIS using URL Rewrite
Action type: Redirect
Redirect URL: https://{HTTP_HOST}/{R:1}
Redirect type: See Other (303)
You can also simply add the following lines to the website’s configuration file (web.config):
URL rewrite
 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s