IIS 6 Administration

Sometimes when you are managing a website, you may need to move content to some other location to reorganize your site or for some other purpose. As a result, clients who try to access this content using URLs saved in their Favorites folder will receive “HTTP 404—File Not Found.” Fortunately, you can use redirection to prevent such errors. Redirection is a way of having IIS tell web browsers that the content they are requesting has moved to a different location by having IIS provide the browser with the new URL for the moved content. The browser responds by automatically trying to open the new location without any intervention by the user.

There are several ways you can redirect client requests for files in a directory on your web server. For example, you can redirect such requests:

Configuring Redirection

To configure redirection for a website or virtual directory, open the properties sheet for that site or directory and select the Home Directory or Virtual Directory tab. For example, you can redirect requests to content in the root of the Default Web Site to a specific page message.htm in the root of the Test website created earlier. To do this, first use Notepad to create a file named message.htm that has a short message in it, and then save this file in the C:\ folder on the IIS machine. Now do the following:

  1. Open the properties sheet for the Default Web Site in IIS Manager and select the Home Directory tab.

  2. Select the option A Redirection to a URL.

  3. The Home Directory tab now changes to display redirection settings (Figure 16-15).

    Figure 16-15: Configuring redirection

  4. Select the check box labeled The Exact URL Entered Above, and type http://IP_address/message.htm, where IP_address is the address for the Test website on the IIS machine.

  5. Click OK to close the properties sheet and apply the changes.

  6. Now right-click the Default Web Site in IIS Manager and select Browse, and the message.htm file should be displayed in the results pane.

Other things you can try:

Категории