Does IIS Support URL Rewriting?
No. But then again yes. Let me explain …
URL Rewriting is a technique available on many web servers that
allows you the web master to make changes to URLs requested by clients
before they are processed by your web server.
Become a Patron of Ask Leo! and go ad-free!
This one is best described by example. In a prior entry here I
talked about using
to allow you to log and or redirect when people click an external link
on your site. On the Ask Leo site the links that used
redir.pl look like this:
That example link will take you to http://www.microsoft.com.
Even though redir.pl lets you make short URLs out of long ones, it
still seems rather long and convoluted. And if you care about such things,
many search engine crawlers will not index pages that contain “?” in
Enter URL re-writing. Using URL re-writing, I can specify that any
instance of “r-” in an incoming URL be replaced with
“cgi-bin/redir.pl?”. Then my redirected link looks like this:
The URL redirector intercepts the incoming request, replaces “r-”
with “cgi-bin/redir.pl?”, and passes the result on to IIS for
My example is quite literal – on this site I replace any
instance of “r-“, which means of course that I cannot use “r-” anywhere
else in any of my URLs. That’s something I’m willing to live with for
simplicity. However most URL rewriters use regular expressions for
pattern matching and replacing, so you can get quite specific and
restrictive if specifying exactly what should get replaced and when.
IIS does not support URL rewriting itself. Rather, it supports an
extension interface called ISAPI which allows add-ons to be installed
into IIS. Add-ons like URL rewriters, for example.
Here are a few of the available rewriters at this writing: