URL Rewriting

URL rewriting on IIS is possible only when you install URL Rewriting module on the server.

Please follow the link below to download URL Rewrite module for IIS:

http://www.microsoft.com/en-au/download/details.aspx?id=7435

URL Rewriting is a rule-based mechanism. After the successful installation of the module, you will be able to see an icon for  “URL Rewrite Module”. Create rules for rewriting URLs as per your requirement.

You can write rules for modifying the URLs individually on each website by adding “WEB.CONFIG” with appropriate code.

Ex : Removing ‘.php’ extension from URLs, code for web.config file as follows:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}.php" matchType="IsFile" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="{R:1}.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Installing IIS Server on Windows 7

  1. Click Start and then click Control Panel.
  2. In Control Panel, click Programs and then click Turn Windows features on or off.
  3. In the Windows Features dialog box, click Internet Information Services
  4. Internet Information Services > World Wide Web Services > Application Development Features > CGI, tick the checkbox next to CGI and then click OK.
  5. When the installation finishes, go to start menu and search for inetmgr
  6. You can start creating the websites on your home computer
  7. To see if your IIS server working, go to your favorite browser and type in “http://localhost” , this directs you to the default page on your IIS server
  8. If the above link doesn’t work, type in your IP Address in address bar which can be found by entering the “ipconfig” command in your command prompt window.