====== Redirecting Web Traffic to Temporary Maintenance Page - Windows 2003 (Deployment,Web) ====== ====== ====== ==== Created at 28 DEC 2011 02:57PM ==== This article walks through the process of redirecting visitors to a system maintenance page during website upgrades and maintenance. Without a system maintenance page visitors may receive error messages from the web server or broken functionality. The system maintenance page enables you to easily notify your visitors of the site status.   The redirection is accomplished by changing a single Windows 2003 IIS configuration setting. This can be enabled and disabled by a batch file command or command prompt. Any requests made to files in a redirected virtual directory will be automatically directed to the maintenance page.   By default IIS includes an administrative script AdsUtil.vbs located at %SystemDrive%\Inetpub\AdminScripts\AdsUtil.vbs This script will be used to enable and disable the HttpRedirect property for the virtual directory where the OpenInsight system is hosted. More information about the Adsutil.vbs script and capabilities can be found at [[http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d3df4bc9-0954-459a-b5e6-7a8bc462960c.mspx?mfr=true|this technet article]].   **Setup and Required Information** Please complete these three steps before attempting to use the redirect commands. You'll need information gathered during these steps to use in the redirection command.   1.     You must first create a static HTML page to display the maintenance message users should see. In this procedure the example maintenance page URL is http:%%//%%www.yourdomain.com/maintenance.html 2.       3.     Note: Do not create this page in the virtual directory which will be redirected. 4.       5.     Open the Internet Information Services (IIS) Manager and locate the site number. The easiest place to find the site number is by opening the properties for the site. Open the properties dialog for the site and click the logging properties button, and locating the "Log File Name:" on the "Logging Properties" window. The website number follows the prefix W3SVC. Make a note of the website number, you'll need it later. 6.       7.     The image below displays the log file name for the default website properties and shows the website number is "1". This corresponds by the first default website but your value might be much larger. 8.  {{kb0292_1.png}} 9.     Image showing log file name to locate the website number. 10.    11.  Before closing the Internet Information Services (IIS) Manager window locate the virtual directory that corresponds to the website you want to redirect traffic to. Make a note of the name because you'll need it in the commands below. In the example image blow the example virtual directory is "O4W". 12.  {{kb0292_2.png}} **Redirect Commands** With the required information gathered you can now enable and disable redirection to your virtual directory with the following commands. Substitute the bracketed sections in bold with the values that apply to your specific site from the directions above. You can execute these commands from a command prompt or batch file on the server. Changes take effect immediately.   **Enable Redirection** cscript.exe %SystemDrive%\Inetpub\AdminScripts\AdsUtil.vbs SET W3SVC/****/ROOT/****/HttpRedirect "****?"   Tip: The trailing "?" on the end of the URL is required for the redirection to work properly.   **Disable Redirection** cscript.exe %SystemDrive%\Inetpub\AdminScripts\AdsUtil.vbs DELETE W3SVC/****/ROOT/****/HttpRedirect   Using the example values referenced in the procedure the command to enable redirection is:   cscript.exe %SystemDrive%\Inetpub\AdminScripts\AdsUtil.vbs SET W3SVC/1/ROOT/O4W/HttpRedirect "http:%%//%%www.yourdomain.com/maintenance.html?"   Disabling the redirection is performed with this command:   cscript.exe %SystemDrive%\Inetpub\AdminScripts\AdsUtil.vbs DELETE W3SVC/1/ROOT/O4W/HttpRedirect   The redirection commands empower you to easily manage system maintenance messages during OpenInsight and website upgrades. Your visitors will be better informed about the state of the website and help ease frustration caused during maintenance periods.