Redirecting Web Sites
There are many reasons that you may need to redirect a Web site. You may have reorganized your site, focused it, and moved some content to another domain, or changed it as a result of a change in your company. No matter what reason you have for redirecting a Web site, IIS 7 makes the task easy to perform.
The essential issue is to choose the right level for the redirection. If you want to redirect only an application or other resource on a Web site, make sure that you choose that level in the Connections pane of the Internet Information Services (IIS) Manager console. In fact, because a redirection can disrupt people using your Web site, you want to double-check your selection before you do anything. The following steps help you redirect a Web site:
- Double-click the HTTP Redirect icon. You see the HTTP Redirect window.
- Check Redirect Requests to This Destination.
- Type the URL for the new location.
- (Optional) Check Redirect to the Exact Destination.
Normally, IIS 7 uses relative redirection so that the user sees the same content in the new location. Relative redirection assumes that you duplicated the content in the new location to match that of the old location.
When you don't provide precise duplication, you need to redirect the user to the exact destination you provide so that the browser displays the content you intended rather than an error message saying that the server couldn't find the content. You should also use this option to display an error message or a content-moved Web page.
- (Optional) Check Only Redirect Requests to Content in This Directory. Use this option when the subdirectories for a Web site are still functional and only the content at an upper level has changed. In most cases, you don't use this option.
- Choose one of the Status Code options.
The status code you choose determines how the browser interacts with the redirection and which information you see. You have the following status code options (you can see a complete list of standard HTTP status codes at http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html):
- Found (302): Tells the browser that the server has found the required content in another location but doesn't indicate whether the change is permanent or temporary.
- Permanent (301): Tells the browser that the server has found the required content in another location and that the change is permanent. In some cases, the browser prompts the user to update their bookmarks to the new location.
- Temporary (307): Tells the browser that the server has found the required content in a temporary location but that the content should appear in the old location sometime in the future.
- Click Apply to make the settings active.