IIRF.ini for URL rewriting
We often hear the terms like URL rewriting or friendly URLs. There are many techniques available to achieve it and we will discuss one of those today, IIRF.
What is URL rewriting?
Before we try to understand URL rewriting, we should first understand a term called SEO friendly URLs,Read more about it here. When Google and Yahoo spiders start indexing the page, they take various parameters in account for indexing the page and one of the most important parameter is URL. URL should be more user friendly and human readable. For example,
A URL like codespread.com/article?p=123 is not human readable or user friendly, it should be rewritten something like codespread/article/know-url to get a better search ranking/indexing.
Above explanation fulfils the need of URL rewriting.
How can it be achieved?
URL rewriting can be achieved by either with ISAPI filters at the IIS Web server level, or with either HTTP modules or HTTP handlers at the ASP.NET level. We are going to focus on ISAPI filter at the IIS web server level.
We have a free and open source ISAPI filter for IIS URL rewriting from Ionic: IIRF: Ionic’s ISAPI Rewriting Filter. It installs as an ISAPI Filter on the IIS server.
Note:IIS servers do not support URL rewriting by default. IIS7 servers support native component for URL rewriting.
Refer this beautiful article to install ISAPI filter. http://wiki.gxtechnical.com/commwiki/servlet/hwiki?How+to+install+URL+Rewrite,
In IIS7, URL rewrite will be seen as,
In II6, IIRF.dll can be seen inside ISAPI filters property. Both option uses IIRF.dll for basic filter. After this, we just need to edit the configuration file ‘IIRF.ini’ to establish rules.
What is IIRF.ini?
‘ini’ file is a simple text file with an extension of ‘Initialization’. It provides the settings for the sites which is the configuration information normally referred to as the rules. These rules describe how to rewrite or redirect URLs and headers.
For each site,at least one IIRF.ini is necessary. It is required to locate the IIRF.ini file in the root physical path for each web site or web application.
IIRF uses regular expression for rules like \d, \D, \w, \W, \s, \S. An example:
This is a basic introduction to IIRF. There is more information and examples available at http://iirf.codeplex.com/wikipage?title=Examples