web.config for Wordpress
I had to deploy a Wordpress site to a windows shared hosting server. After doing so, only the site's front page worked while the others pages were just blank.
At first I thought this might have something to do with caching. After turning caching off, deleting cache files, etc. I noticed the .htaccess
file and realised that I might have to update the web.config
file since I'm on Windows.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true"/>
<defaultDocument>
<files>
<clear/>
<add value="Default.htm"/>
<add value="index.htm"/>
<add value="Default.cshtml"/>
<add value="index.php"/>
<add value="index.html"/>
<add value="index.pl"/>
<add value="default.html"/>
<add value="index.cshtml"/>
<add value="Default.aspx"/>
</files>
</defaultDocument>
<staticContent>
<remove fileExtension=".svg"/>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml"/>
</staticContent>
<httpProtocol>
<customHeaders>
<clear/>
</customHeaders>
</httpProtocol>
<rewrite>
<rules>
<rule name="wordpress" 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>