If you're running a Windows Server and you have to run PHP websites on it chances are that you will be asked to apply rules from a .htaccess file to one of the websites on your server. Windows Server does not use .htaccess files. These usually come from Apache servers. However, Windows Servers use a similar file called the Web.Config file located at the root of all your websites hosted on your Windows Server.
You'll be glad to know that there is a converter built into IIS 7 that will convert any .htaccess rules into the format required for the Web.Config file. To convert your .htaccess file simply follow these instructions:
- Log onto your server and open IIS.
- Double click on the 'URL Rewrite' icon from the list under 'IIS'.
- Click on 'Import Rules...' from the right side bar.
- Copy the htaccess contents supplied to you and paste them into the 'Rewrite Rules' text box. Once pasted you should notice the 'Converted Rules' area will update. If you click on the XML tab you will see the Web.Config format of the rule entered.
- Ensure you're looking at the Tree tab and right click on the 'rule name' tag in the Tree View and click on 'Rename' to rename the rule to something other than 'Imported Rule 1' so it will make more sense to anyone looking at the web.config file later on.
- Click on 'Apply' from the right side bar and your rule will be added to your web.config file.
That's it. You're all done! Nice and easy.