WordPress Installed in Sub Directory on Windows Server Not Loading

Experience with WordPress windows-server

Setting up and running a WordPress content management system on a Windows Server isn’t always as simple as its Unix counterpart. There’s always something that could go wrong and course I had a pretty interesting experience setting a blog on one of the website I am working on.
Well, I have been working on an ASP.Net Core web application, I wanted to install WordPress in a sub directory to add a blog to the site. At first I thought it would be simple to do so, but I ran into issues after I had installed and setup the whole blog.

WordPress windows-server Error

Well, the problem I was having was that when navigating to the folder which WordPress was installed, I was getting a 404 error as shown below.

This www.example.com page can’t be found No webpage was found for the web address: https://www.example.com/blog


In order to resolve this issue I have read a few post describing the possible cause which was related to the .htaccess file that could be missing on the server. Well, since this was a Windows box, there was a web.config file instead.

I then updated the web.config file on the server with the following content and voila it works. Simply replace “yourdomainname” text with your actual domain.

<?xml version="1.0" encoding="UTF-8"?>
	 <rule name="WordPress: http://yourdomainname.com/blog" patternSyntax="Wildcard">
	   <match url="*"/>
		  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
		  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
		<action type="Rewrite" url="index.php"/>
      <remove name="aspNetCore"/>
    <aspNetCore processPath="dotnet" arguments=".\yourdomainname.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"/>

Leave Comment

Your email address will not be published. Required fields are marked *