12.14. Configuring Web Site Redirection

Problem

You want to redirect requests for files in your web site to a different site, directory, or file.

Solution

Using a graphical user interface

To redirect requests to files in your web site's home directory, do the following:

  1. Open Internet Information Services (IIS) Manager.

  2. In the left pane, expand the console tree to display your web site, right-click on the site, and select Properties.

  3. Select the Home Directory tab.

  4. Select the option named A redirection to a URL.

  5. Select the option The exact URL entered above, if you want to redirect requests to a specific file. For example, type /temp/default.htm in the Redirect to box if you want to redirect requests for files in your home directory to the default.htm file in the /temp virtual directory.

  6. Select the option A directory below URL entered, if you want to redirect requests to files in a subdirectory. For example, type /newsite in the Redirect to box if you want to redirect requests for files in your home directory to a new version of your site in the /newsite subdirectory.

  7. Select the option A permanent redirection for this resource, if you want to send an "HTTP 301 Permanent Redirect" status message to clients requesting files from your home directory.

To redirect requests to files in a virtual directory, do the following:

  1. Open Internet Information Services (IIS) Manager.

  2. In the left pane, expand the console tree to display your web site, right-click on a virtual directory, and select Properties

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.