Fixing Broken Links: The Complete IIS Redirect Tutorial

Written by

in

Mastering IIS Redirects for Better Site Migration and SEO Website migrations are complex projects. Moving content, changing domain structures, or switching to HTTPS can easily disrupt your user experience. More importantly, poorly executed migrations can destroy your organic search rankings.

When hosting on Windows Server, Internet Information Services (IIS) provides the framework to manage these transitions. Mastering IIS redirects ensures that users and search engine crawlers find your new pages seamlessly, preserving your hard-earned Search Engine Optimization (SEO) value. Why IIS Redirects Matter for SEO

When a URL changes, search engines treat the new address as an entirely separate page with zero history. If you do not guide the search engine to the new location, you lose your search rankings, traffic, and authority. Preserving Link Equity

Link equity, or “link juice,” is the ranking power passed from one page to another through hyperlinks. A proper redirect acts as a permanent forwarding address. It signals to Google and Bing that the old page has permanently moved, allowing up to 95–99% of the ranking power to transfer to the new URL. Preventing 404 Errors

If a user clicks an old link and encounters a “404 Page Not Found” error, they will likely leave immediately. High bounce rates and broken links signal a poor user experience to search engines, which can negatively impact your overall site authority. Enhancing Crawl Budget Efficiency

Search engines allocate a specific amount of time and resources to crawl your website. Broken links and redirect loops waste this crawl budget. Efficient IIS redirects help bots discover your new content structure without getting stuck in technical dead ends. The Anatomy of HTTP Redirect Status Codes

Before configuring IIS, you must understand the two primary HTTP status codes used during website migrations. Choosing the wrong one can confuse search engines and delay your SEO recovery.

[Old URL] —> (HTTP 301) —> [New URL] –> Search engines update index permanently. [Old URL] —> (HTTP 302) —> [New URL] –> Search engines keep old URL indexed. 301 Moved Permanently

This is the gold standard for SEO migrations. A 301 redirect tells search engine crawlers that the old URL is gone forever and should be replaced by the new URL in their index. This code triggers the transfer of link equity. 302 Found (Moved Temporarily)

A 302 redirect indicates that the move is only temporary. Search engines will continue to index the old URL and will not transfer link equity to the new one. Use this only for short-term maintenance or seasonal promotions, never for permanent site migrations. How to Configure Redirects in IIS

IIS offers two main methods to implement redirects: the graphical User Interface (UI) via the IIS Manager, and programmatic configuration using the web.config file. Method 1: Using the IIS Manager GUI

The IIS Manager GUI is ideal for straightforward, site-wide changes or simple page-to-page mappings.

Open IIS Manager and navigate to the site or folder you want to redirect in the left-hand Connections pane. In the features view, double-click the HTTP Redirect icon.

Check the box labeled Redirect requests to this destination.

Enter the absolute URL of the target destination (e.g., https://newsitedomain.com).

Under Redirect Behavior, check Redirect all requests to exact destination if you want all old traffic hitting a single landing page. Alternatively, check Only redirect requests to content in this directory depending on your mapping needs. Select Permanent (301) from the status code drop-down menu. Click Apply in the right-hand Actions pane. Method 2: Editing the web.config File

For advanced migrations, dynamic routing, or bulk rules, editing the XML-based web.config file in your site’s root directory is faster and more powerful. This method utilizes the IIS URL Rewrite Module, which must be installed on your server. webServer> section:

Use code with caution. Core Migration Scenarios and Code Snippets

Different migrations require different redirect logic. Below are the three most common scenarios implemented via the web.config file. 1. Enforcing HTTPS (SSL Migration)

Securing your site with HTTPS is a confirmed Google ranking factor. To force all non-secure HTTP traffic to your secure HTTPS site, use this rule:

Use code with caution. 2. Canonicalizing WWW vs. Non-WWW

Search engines view example.com and ://example.com as two identical websites with duplicate content, which splits your SEO authority. Pick one format as your canonical version and redirect the other. To redirect all non-www traffic to your www domain:

Use code with caution. 3. Preserving URL Parameters During Structure Changes

If you are changing your folder architecture (e.g., moving from /blog/post-title to /articles/post-title), you must capture the trailing URL string. The {R:1} back-reference token in the action tag automatically appends everything matched in the (.*) expression to the new path, keeping your deep links intact. Common IIS Redirect Mistakes to Avoid

A single typo in your server configuration can take your entire site offline or tank your search rankings. Keep an eye out for these frequent pitfalls:

Redirect Loops: This occurs when Rule A points to Page B, but Rule B accidentally points back to Page A. Browsers will eventually give up and display a “Too Many Redirects” error. Always double-check your match patterns to ensure they are mutually exclusive.

Chained Redirects: Avoid redirecting Page A to Page B, and then Page B to Page C. Every “hop” in a redirect chain degrades your page loading speed and dilutes the amount of link equity transferred. Target the final destination directly on the first redirect.

Case-Sensitivity Issues: Windows servers are case-insensitive by default, but URLs can be strict. Ensure your regex matching rules include ignoreCase=“true” to prevent missed patterns caused by capital letters. Post-Migration Checklist and Testing

Configuring the server is only half the battle. You must verify that your configuration works in production.

Test with Curl or Browser Developer Tools: Open your browser’s network tab or use a command-line tool like Curl to inspect the HTTP response headers of your old URLs. Verify that the server returns a 301 Moved Permanently status code and points to the exact correct location.

Update Google Search Console: Use the Change of Address tool inside Google Search Console to officially notify Google of your domain migration. This accelerates the re-indexing process.

Submit a New XML Sitemap: Provide search engine bots with an updated roadmap of your new URL structure to ensure they crawl your fresh content immediately.

Monitor Crawl Errors: Check your server logs and search console dashboards daily for the first two weeks post-migration to catch and fix any unexpected 404 errors.

By leveraging the native power of IIS and the URL Rewrite module, you can execute a seamless site migration that keeps both your users and search engine algorithms satisfied.

If you want to start writing the configuration code, let me know:

What type of migration you are running (e.g., domain change, folder restructure, HTTP to HTTPS) If your current URLs contain query strings or parameters

If you have the IIS URL Rewrite Module installed on your server

I can generate a tailored web.config script specifically for your environment.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *