Helping people with computers... one answer at a time.
URL Rewriting is a powerful was 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
Can I redirect my /index.php to / using the Ionic's ISAPI Rewrite Filter? Or is there any easier way to do this ?
Posted by: Nizar at February 19, 2010 3:16 AMI 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.
Posted by: Andrew at March 14, 2010 2:03 PMYou 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.
Posted by: Salman at February 25, 2011 5:01 AMIIS does not support URL rewriting itself. Rather, it supports an extension interface called ISAPI which allows add-ons to be installed into IIS.
Posted by: technical support Vancouver Wshington at May 19, 2011 7:25 AMhi,
Posted by: Kaushal Shah at November 9, 2011 10:29 AMI 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.