Helping people with computers... one answer at a time.
URL Rewriting is a powerful way for webmasters to control what a URL really represents. IIS requires an extension in order to support url rewriting.
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.
•
This one is best described by example. In a prior entry here I talked about using redir.pl 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:
http://ask-leo.com/cgi-bin/redir.pl?ms
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 their URLs.
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:
http://ask-leo.com/r-ms
The URL redirector intercepts the incoming request, replaces "r-" with "cgi-bin/redir.pl?", and passes the result on to IIS for processing.
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:
Article C1836 - August 26, 2003 « »
March 14, 2010 2:03 PM
I used ISAPI_Rewrite myself. Nice stuff, does a lot. As a result a switched to Helicon Ape - Apache emulator for IIS. It has a rich functionality mod_rewrite, mod_proxy, mod_auth, mod_gzip, mod_headers, mod_cache, mod_expires, mod_developer, mod_replace, mod_so, mod_speling, mod_usertrack and others.
February 25, 2011 5:01 AM
You can have PATHINFO style URLs on IIS. They do not require any components and look reasonably OK. An example of a such URL would is:
http://localhost/app/index.php/products/1234/details
Technically speaking, this is not apache/htaccess style URL "rewriting" but this kind of URL is still better than http://localhost/app/product-etail.php?id=1234 in terms of SEO.
Also, unlike htaccess style rewriting which is almost transparent, this technique requires "coding" changes so that your scripts check for a server variable called "PATH_INFO" instead of/in addition to checking query strings.
May 19, 2011 7:25 AM
IIS does not support URL rewriting itself. Rather, it supports an extension interface called ISAPI which allows add-ons to be installed into IIS.
November 9, 2011 10:29 AM
hi,
I am looking for the example link where there are steps to do the URL shortening via IIS ISAPI. I want the link which has screen shots also so that its easy to understand how it works. does anybody knows about any such links? please let me know if there are any.
April 5, 2012 2:54 PM
As a site owner I believe the subject matter here is reallyfantastic. I appreciate it for your efforts. You should keep it up forever! Best of luck.
•
Comments on this entry are closed.
If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.
If you don't find your answer, head out to http://askleo.com/ask to ask your question.