bouncing balls graphic

Redirect URLs in Microsoft Internet Information Server

You can redirect Web requests as they hit your Microsoft Internet Information Server (IIS) and send them to a new location.  This can help if you are moving content around and want people to get to it using links you have shared in the past.

IIS has a graphical user interface for redirecting and rewriting URLs but it was surprisingly complicated to understand how to do this.  In particular, if you are trying to redirect from a database-driven Web page to another resource, the Microsoft Internet Information Services Manager console can be confusing.  Worse, it can mislead you into thinking that you can’t complete your redirect or that you need to edit the global.asa file or know ASP programming.

Your Microsoft Tools

Let’s take a moment to distinguish the tools you have available.  The first thing you’re going to do is run the Internet Information Services (IIS) manager.  This used to be called the IIS MMC (Microsoft Management Console).  Inside the manager is a tool called HTTP Redirect.

You can either access the tool directly or, from within the IIS manager, navigate through your Web site and right-click on the folder.  Here are Microsoft’s instructions.  It’s a very simple process.

Unfortunately, the HTTP redirect only works if you have a physical item on your Web server – a file or folder – that you can point the tool at.  If you are taking a database-driven URL – like – then the HTTP redirect tool isn’t going to work for you.

Instead, you want to use the URL Rewrite tool.  It is also an extension for the IIS manager and will appear – once you install it from here – in the same list of tools as the HTTP Redirect one.

Create a URL Rewrite Map and Rule

Once the URL Rewrite tool is installed, can create any rule you like.  If you are familiar with Apache’s mod_rewrite syntax, this is similar and it is possible to use regular expressions to match multiple files or types of URL.  However, this being Microsoft, there is a GUI for the most basic rules and they  even have some templates.

Unfortunately, the documentation for using the URL Rewrite module wasn’t very clear to me.  If you are doing a simple URL rewrite, it’s a lot of information to do a very simple thing.

The method I used was to create a Rewrite Map. Open the IIS manager and then select URL Rewrite from the list of IIS tools.  When it opens, click on View Rewrite Maps from the list of actions on the right-hand side of the window.

The map is a listing of source URLs and the corresponding destination, so you can type in anything you like.  If you are just going from a URL to a URL, you can put those in.  You can also include wildcards and regular expressions.  In my case, I just wanted one page to end up at another page.  This is my Rewrite Map:

A list of two source URLs - one a static page and one database-driven - forwarded to another Web page using the Microsoft IIS URL Rewrite tool.
A list of two source URLs – one a static page and one database-driven – forwarded to another Web page using the Microsoft IIS URL Rewrite tool.

As you can see, it assumes that you’re on the server.  The value can be anything, though, so if you had subfolders in the URL, they can be added.  As you can see, the first original value – source URL – is a static Web page.  The second is a dynamic page, pulling content with an ID from a database.  To add your entries, click on Add Mapping Entry under the right-hand list of actions.

Note:  these values do not need to exist in reality.  Since the URL is being rewritten before the request hits your content management system and database, you can test these redirects with totally bogus URLs.  If the URL is received by IIS, it will forward it.  IIS does not know whether the resource exists or not.  If your CMS does not support URL forwarding within its system, you can manage it outside the CMS.

There are other values and tweaks you can make to your Rewrite Map.  I have no idea what they mean and, for my purposes, they are immaterial.  At this point I thought I was finished and yet my URLs were not being redirected properly.

You need to apply a Rule to your Rewrite Map before anything starts working.  This point was lost on me when I was trying to figure this out.  Under the right-hand list of actions, choose Back to Rules.  Then select Add Rule(s)… from that same right-hand action list.

Microsoft IIS 7 URL Rewrite Rule using a Rewrite Map
Microsoft IIS 7 URL Rewrite Rule using a Rewrite Map

Microsoft’s all about templates and making things simple.  Once you get this far, it’s like falling off a log.  Choose the Rule with a Rewrite Map template and then, when the configuration page opens, select your Map from the drop-down list.  That’s it.  Click OK and your rewrites should be working.

It’s a bit like editing a .htaccess file on an Apache site.  You do not need to restart your server for the rewrites to start working.  And I’m ignoring a lot of the power that is available in the rewrite and redirect process, because it’s way beyond my level of understanding and interest.  There appears to be a way to redirect URLs and note that they are 301 permanent redirects for Google and Bing to notice.  It looks like you do this by creating the URL redirect within the Rule, so I’m not sure how it would apply to a Map.

David Whelan

I improve information access and lead information teams. My books on finding information and managing it and practicing law using cloud computing reflect my interest in information management, technology, law practice, and legal research. I've been a library director in Canada and the US, as well as directing the American Bar Association's Legal Technology Resource Center. I speak and write frequently on information, technology, law library, and law practice issues.