Microsoft KB Archive/324000

= How to redirect URLs to different Web sites =

Article ID: 324000

Article Last Modified on 11/22/2006

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Small Business Server 2000 Standard Edition
 * Microsoft Internet Information Services 5.0

-



This article was previously published under Q324000





We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:

http://www.microsoft.com/technet/security/prodtech/IIS.mspx



SUMMARY
This article describes how to translate redirection and rewriting configurations from an Apache configuration file to Internet Information Services (IIS).

Redirecting URLs
When you use Apache, you can redirect URLs by using the Redirect directive to point a folder or a location to a different folder on either the same Web site or a different Web site. You can also alias a folder to another location by using the Alias directive. If you use IIS, you can perform the same tasks by using the URL Redirection functionality.

To redirect a folder or file IIS:
 * 1) Log on to the Web server computer as an administrator.
 * 2) Click Start, point to Settings, and then click Control Panel.
 * 3) Double-click Administrative Tools, and then double click Internet Services Manager.
 * 4) Right-click the Web site or the folder, and then click Open.
 * 5) Right-click the folder display, point to New, and then click Folder.
 * 6) Return to Internet Services Manager.
 * 7) Right-click the folder that you just created, and then click Properties.
 * 8) Click the Directory tab, and then click A redirection to a URL.
 * 9) To redirect the folder to another URL, click the URL of the folder or the Web site that is described in step 4, and then type the complete URL to the new site in the Redirect to box.
 * 10) To redirect the folder to another folder within in this folder (for example, Projects to Sections/Departments/Projects), click A directory below this one, and then type the new folder in the Redirect to box.
 * 11) To mark the redirection type as a permanent redirection (and not a temporary redirection), click A permanent redirection for this resource.

If you use this setting, bookmarks and other details are automatically updated on some browsers.
 * 1) Click OK to save the changes.

Rewriting URLs
If you use Apache, you can use the regular expression system to rewrite or redirect URLs to different folders, files, or directories. If you are using IIS, you can perform the same task by using a combination of wildcard characters and replacement variables. See the following table to determine the elements of a URL that you can substitute during a rewriting procedure.

IIS supports the following wildcard characters:
 * Asterisk (*): The wildcard character for any character
 * Question mark (?): The wildcard character for a single character.

You use the redirection functionality described earlier in this article to activate the rewriting. Make sure that the Redirect to box contains the source and the destination URL, separated by a semicolon.

For example, to redirect all the files that end with .html to the Default.html file:
 * 1) Right-click the folder that you want to use as the base for rewriting, and then click Properties.
 * 2) Click the Directory tab.
 * 3) Click A redirection to a URL.
 * 4) Click the exact URL of the folder that is described in step 1.
 * 5) Type *.html;default.html in the Redirect to box.
 * 6) Click OK to accept the changes.

To redirect the query for a script to a different script, for example, to redirect myscript.asp?number=1 to newscript.asp?number=1:
 * 1) Right-click on the original script, and then click Properties.
 * 2) Click the File tab.
 * 3) Click A redirection to a URL.
 * 4) Click the exact URL of the script that is described in step 1.
 * 5) Type newscript.asp$Q in the Redirect to box.
 * 6) Click OK to accept the changes.

