How to Redirect One Domain to Another in IIS Using URL Rewrite
How to Redirect One Domain to Another in IIS Using URL Rewrite
When managing multiple domains in Internet Information Services (IIS), you may come across situations where one domain should automatically redirect to another. This is commonly required during domain changes, branding updates, or consolidation of multiple domain names into a primary address.
In this article, we will explain how to configure a 301 Permanent Redirect from one domain—example.org.in—to another domain—example.org—using the URL Rewrite module in IIS.
Prerequisites
Before you begin, ensure that:
IIS is installed on your Windows server.
The URL Rewrite module is installed. (If not, download it from the official Microsoft website.)
The domain example.org.in is already added as a site or binding in IIS.
Step-by-Step Guide to Set Up the Redirect
Step 1: Open IIS Manager
Press Windows + R, type inetmgr, and click OK.
In the left-hand Connections pane, locate and select the example.org.in website.
Step 2: Open URL Rewrite
Inside the site’s feature view, double-click URL Rewrite.
Click “Add Rule(s)…” on the right-hand Actions panel.
Step 3: Create a Blank Rule
Select Blank Rule and click OK.
Name the rule something meaningful, such as: Redirect to example.org
Step 4: Configure the Match URL Section
Requested URL: Matches the Pattern
Using: Regular Expressions
Pattern:
This ensures the rule matches all incoming requests.
Step 5: Configure the Condition
We want the redirect to occur only when visitors access the example.org.in domain.
Under Conditions, click Add.
Enter the following:
Condition Input:
Check if input string: Matches the Pattern
Pattern:
The domain name is escaped with backslashes because dots have special meaning in regex.
Step 6: Configure the Action
In the Action section, enter the following:
Action type: Redirect
Redirect URL:
Redirect type: Permanent (301)
This ensures all traffic from the old domain moves to the new one and preserves the URL path.
Step 7: Apply the Rule
Click Apply on the right-hand panel.
Restart IIS or recycle the application pool if necessary.
Your redirect rule is now active.
Alternative: Using web.config
If you prefer to configure the redirect directly in the web.config file, use the following snippet:
Place this inside the <system.webServer> section of the web.config file.
Conclusion
Setting up a domain redirect in IIS using the URL Rewrite module is a reliable way to ensure users are seamlessly redirected to the correct domain. Whether you are migrating to a new domain or consolidating multiple domains, this approach maintains SEO value and prevents broken links.
Last updated
Was this helpful?