Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to redirect requests from HTTP to HTTPS or to the OWA virtual directory in IIS 7


View products that this article applies to.

Introduction

Redirection is one way to make sure that users always receive the Web page that they want. Redirection refers to the process by which the Web server is configured to issue a redirect message to the client. For example, HTTP response status code "302 Found" is the most common way to perform a redirection. The redirect message instructs the client to resubmit the request for a new location. Specifically, the message redirects users to another file, to another directory, or to another Web site.

Redirection is helpful in the following scenarios:
  • You change the location of your Web site, and want to redirect users to the new location.
  • Your Web site is under construction, and you want to make part of the site unavailable.
  • Your content is not located on the Web server.
  • You have changed the name of a virtual directory, and you want users to have access to files from the old URL.
By default, Internet Information Services (IIS) 7 has the built-in automatic HTTP Redirect feature that lets you redirect users to any URL or virtual directory without requiring you to write custom scripts.

↑ Back to the top


Resolution

Consider the following scenarios.

Scenario 1

The Require SSL option is not selected on the default Web site or in the OWA virtual directory in IIS 7.

Note The virtual directory can be any directory in the Web site. For example, the virtual directory may be named "/Test" or "/SomeContent."

To configure automatic redirection to an OWA directory under the default Web site in IIS 7, follow these steps:
  1. Start IIS 7 Manager.
  2. Select the default Web site, and then make sure that you are in Features View.
  3. Double-click HTTP Redirect. Or, right-click HTTP Redirect, and then click Open Feature.

    Note If you do not find the HTTP Redirection feature, make sure that it was installed in IIS. To install the HTTP Redirection feature, follow the steps:
    1. Open Server Manager, and then expand Roles.
    2. Right-click Web Server (IIS), and then click Add Role Services.
    3. Under Web Server, click to select the HTTP Redirection check box.
    4. Click Next to complete the installation.
  4. Click to select the Redirect requests to this destination check box, and then type /OWA.
  5. In the Redirect Behavior section, click to select the Only redirect requests to content in this directory (not subdirectories) check box.
  6. In the Status code list, select Found (302).
  7. Click Apply to save the settings.

    Note�If the new setting does not take effect immediately, recycle the appropriate application pool.
Test the application to determine whether you are automatically redirected to the /OWA directory when you enter the http://localhost URL location on the browser's Address Bar.

Scenario 2

If the Require SSL option is selected on the default Web site or in the OWA virtual directory in IIS 7, you may receive the following error message when you enter the location on the browser's Address Bar:

HTTP Error 403.4 - Forbidden The page that you are trying to access is secured with Secure Sockets Layer (SSL).

For example, you may receive this error message when you enter "http://mail.contoso.com" or "http://localhost." To configure automatic redirection from HTTP to HTTPS and also to /OWA, follow these steps:
  1. Start IIS 7 Manager.
  2. Select the default Web site, and then make sure that you are in Features View.
  3. Double-click HTTP Redirect. Or, right-click HTTP Redirect, and then click Open Feature.
  4. Click to select the Redirect requests to this destination check box, and then enter the absolute OWA URL. For example, enter https://mail.contoso.com/OWA.
  5. In the Redirect Behavior section, click to select the Only redirect requests to content in this directory (not subdirectories) check box.
  6. In the Status code list, select Found (302).
  7. Click Apply to save the settings.

    Note If the new setting does not take effect immediately, recycle the appropriate application pool.

↑ Back to the top


Important

In Windows Server 2008, you can add a redirection at the top (master) level. This setting is passed down to the lower levels. If there is a lower level for which you do not want this setting inherited, clisk to clear the�Redirect requests to this destination check box under the HTTP Redirect feature for that particular level.

These options are available for the virtual directories that physically exist in IIS Manager. However, for directories that are available only as virtual directories (for example, Exchange, ExchWeb, and Public), you cannot clear the Redirect requests to this destination check box.

To clear the Redirect requests to this destination check box for the Exchange virtual directory, run the following command:
%Windows%\System32\inetsrv>appcmd set config "default Web site/exchange" /section:httpredirect /enabled:false -commit:apphost
To clear this setting for the ExchWeb and Public virtual directories, run the following commands:
%Windows%\System32\inetsrv>appcmd set config "default Web site/ExchWeb" /section:httpredirect /enabled:false -commit:apphost
%Windows%\System32\inetsrv>appcmd set config "default Web site/Public" /section:httpredirect /enabled:false -commit:apphost
For the Exchange, ExchWeb, and Public virtual directories, the setting is not inherited when you use these commands to clear the Redirect requests to this destination check box.

↑ Back to the top


References

For more information about how to configure HTTP Redirection in IIS 7, visit the following MSDN Web site:

↑ Back to the top


Keywords: KB975341, kbhowto, kbpubtypekc, kbexpertisebeginner, kbsurveynew

↑ Back to the top

Article Info
Article ID : 975341
Revision : 2
Created on : 9/11/2013
Published on : 9/11/2013
Exists online : False
Views : 335