Recently, I installed a WordPress website in the IIS web server and did all the standard settings in the wordpress admin, like general, reading, permalinks. And when running the site all the URL were with index.php eg. site.com/index.php/about-us/. so to remove the index.php from the wordpress site we have to enable directory browsing to true in web.config and add the following rewrite rules in the web.config file.
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <directoryBrowse enabled="true"/> <defaultDocument> <files> <clear/> <add value="index.php"/> </files> </defaultDocument> <httpProtocol> <customHeaders> <clear/> </customHeaders> </httpProtocol> <rewrite> <rules> <rule name="WordPress: http://www.mysite.in" patternSyntax="Wildcard"> <match url="*"/> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/> </conditions> <action type="Rewrite" url="index.php"/> </rule></rules> </rewrite> </system.webServer> </configuration>
For this to work, your IIS should have IIS URL REWRITE MODULE installed