Introduction
This guide provides instructions on how to redirect traffic from one hostname (e.g., test.yourdomain.com.my) to another hostname (e.g., test.dedicatedhosting.com.my) using Internet Information Services (IIS) on a Windows server. This ensures visitors accessing the old hostname are seamlessly routed to the new destination. The guide also covers how to install the required HTTP Redirection feature if it is not already available.
Prerequisite
- Access to the Windows Server with Administrator privileges.
- Internet Information Services (IIS) installed.
Step-by-step guide
Step 1: Install HTTP Redirection Feature
If the HTTP Redirection feature is not yet installed on your server, you can enable it through the Server Manager interface.
Alternatively, you can install the HTTP Redirection feature quickly using a PowerShell command.
Steps for Method 2: via PowerShell
- Open Windows PowerShell as an Administrator.

- Type the following command and press Enter:
Install-WindowsFeature Web-Http-Redirect
- Wait for the installation process to complete successfully.
Expected Output:

Step 2: Configure Redirect
This method involves configuring the hostname redirect directly through the IIS Manager interface.
Steps for Method 1: using IIS Manager GUI
- Open Internet Information Services (IIS) Manager.
- In the Connections pane on the left, expand the server node, expand Sites, and select the site associated with the original hostname (e.g., test.yourdomain.com.my).
- In the middle pane (Features View), double-click the HTTP Redirect feature icon.

- Check the box that says Redirect requests to this destination.
- In the text box provided, enter the new destination URL (e.g., http://test.dedicatedhosting.com.my).
- Under the Redirect Behavior section, configure the options as needed (e.g., check “Redirect all requests to exact destination” if you want all sub-paths to go to the root of the new domain, or leave it unchecked to preserve the path structure).
- In the Status code dropdown menu, select the appropriate redirect type based on your needs:
- Found (302): A standard temporary redirect. Tells browsers to go to the new URL for now, but continue checking the original URL in the future.
- Permanent (301): Tells search engines and browsers the site has moved permanently. This is best for SEO as it passes ranking to the new URL.
- Temporary (307): A modern temporary redirect that ensures the HTTP request method (e.g., GET or POST) does not change when redirected.
- Permanent Redirect (308): A modern permanent redirect that also ensures the HTTP request method is preserved during the redirect.
- In the Actions pane on the right, click Apply to save the changes.

This method configures the redirect by directly modifying the web.config file in the root directory of the site being redirected.
Steps for Method 2: using the web.config File
- Navigate to the physical path (root directory) of the site associated with the original hostname (e.g., test.yourdomain.com.my).
- Locate the web.config file. If it doesn’t exist, create a new text file and name it web.config.
- Open the web.config file using a text editor like Notepad.
- Add or modify the XML structure to include the following configuration. Note the comments explaining what each attribute does, and ensure you replace the destination URL with your actual domain:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- enabled: Activates the HTTP redirect feature -->
<!-- destination: The target URL where traffic should be routed -->
<!-- exactDestination: If false, appends the user's requested path (e.g., /about) to the new domain -->
<!-- childOnly: If false, applies the redirect to the root site and all of its subdirectories -->
<!-- httpResponseStatus: Sets the redirect type (Permanent for 301, Found for 302, Temporary for 307, PermRedirect for 308) -->
<httpRedirect enabled="true" destination="http://test.dedicatedhosting.com.my" exactDestination="true" childOnly="false" httpResponseStatus="Found" />
</system.webServer>
</configuration>
- Save the changes to the web.config file. The changes will take effect immediately.
Step 3: Verify Redirect
Open web browser and type your original URL (In this case, test.yourdomain.com.my) in search bar.
Expected Output: Showing the new destination’s URL and page content. (In this example, test.dedicatedhosting.com.my)

Conclusion
By following this guidance, you can successfully redirect traffic from one hostname to another using Windows IIS, ensuring a smooth transition for your users.
If you face any difficulties in the setup, please don’t hesitate to contact our support team at support@ipserverone.com.