Want to work with us? We're on the lookout for digital experts.

We're hiring

URL Rewrite Without Extension Path / remove extension

Web Bureau

13 May 2011 by Web Bureau


  1. [Rewriter-Rules].xml

    There are number of ways to store the rewriting rules like appending them to the end of your web.config file, a text file or even saving these rules in the database. But the one method I preferred was to create a new .xml file with the list of these rules (in nodes) and placing it on the root of the site.

    These rules are used to nominate pages/files to the URL which the web user requests by typing in the address bar of the browser. This is accomplished by iterating through the rules in the Global.asax file and selecting the one to rewrite which best matches the requested one. Regular Expressions can be used in this file to implement different redirection methods. Your .xml file should look something like:


    The <urlrewrites> is the root node I used which has lists of "rule" nodes representing each rule. Like for example the second rule for "aboutme(.*)" means the URL should rewrite to the proper /mysite/pages/aboutme.aspx.

    But this is not all, that is, it won’t just simply pickup the /mysite/pages/aboutme.aspx to rewrite when the web user requests the link above. We will need to code our way in the Global.asax file.

  2. IIS wildcard mapping and aspnet_isapi.dll filter (removing trailing extensions):

    This step is required if you want to rewrite the extension-less URLs properly. In other words, in order to browse using instead of what you will need to do here is to:

    • Type “inetmgr” (Internet Information Services) in RUN and expand to your website (or the virtual directory)
    • In Windows XP (IIS 5.x), you will need to right click your site/virtual directory
    • Click Properties
    • In “Virtual Directory” tab, click “Configuration…” and in the box that pops up in the process, you need to click “Add”
    • Browse to the %windir%\Microsoft.NET\Framework\[v2.0.50727]\ (the version in square brackets may vary) and
    • Select aspnet_isapi.dll
    • After the selection make sure you uncheck “Check File Existence” and clicking OK

    • In Windows Vista/7 (IIS [6/7].x), you can open Internet Information Services using the same RUN command as described above
    • Expand to your website/directory and selecting it
    • Clicking on “Handler Mappings” and
    • From the side bar options, clicking on “Add Wildcard Script Map…” (if not available you can click on “Add Script Map…”)
    • Browsing and selecting the appropriate aspnet_isapi.dll as described above
    • Giving it a name and clicking OK
    • In some cases, you will also need to “Order” the newly added value to the “second last” position by
    • Clicking the side bar option “View Ordered List” and using the “Up/Down” buttons available in the same sidebar

  3. Application Pool (Classic/Integrated) if required:

    After you have followed all of the steps above as explained and you are still getting an IIS related error (common in Vista and Win7) then it is probably due the "Managed Pipeline Mode" option in Application Pools:

    • Click on Application Pools in IIS
    • Look for your site in the list and double click it
    • Change the option "Integrated" to "Classic" in "Managed Pipeline Mode". If its already "Classic" then try "Integrated" instead


Grow your businessStart a project with us today.

This site uses essential cookies for parts of the site to operate and have already been set. Find out more about how we use cookies and how you may delete them. You may delete cookies, but parts of the site will not work.