I have been playing (a lot) with WordPress on IIS (Windows Server 2019) lately. Nick has been very helpful by guiding me around. WordPress is some kind of an application in the end as long as you stay away from performance-killing plugins.
Even though IIS is not the recommended host for WordPress, it does the job. And the stronger your specs, the better. I get very good results on a very basic AWS Cloud Server with 8GB of RAM on 2 CPU's.
The web.config below is all you need to:
- Have a recent version of PHP working (PHP 8.3.11 in the example below) for all PHP files
- Add the one and only static file handler for all other files.
- Have index.php as your (only) default document
- Have a rewriting rule to mimic the unsupported .htaccess
- Note that this web.config does not deal with any MicroSoft technology (.NET or Classic ASP).
Here it is:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<clear />
<add name="php-8.3.11" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files\PHP\v8311blank\php-cgi.exe" resourceType="Either" requireAccess="Script" />
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read"/>
</handlers>
<defaultDocument>
<files>
<clear/>
<add value="index.php"/>
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="WordPress on IIS" 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>