Default Windows IIS WordPress web.config XML

Recently I was migrating a test site from a Linux/cPanel based web-host over to a Windows Server running IIS. After migration, none of the site’s pages or posts worked and all returned 404 errors.

I’m familiar with .htaccess files causing 404 problems so I knew that was probably the issue, and since this was now on a Windows server I knew it had to be the IIS equivelant file “web.config” causing problems. Upon further investigation I realized there was no web.config file at all even though I was used to it always being there after setting WordPress up through IIS. Since I’m using Server 2016 for the first time, perhaps things are different and web.config files aren’t created automatically any longer.

Either way, my problem was solved by adding this XML to a newly created web.config file in the site’s root folder:

Now pages and posts are working properly and pretty permalinks are functioning as they should! Note: If “URL Rewrite” is not installed then it will need to be first in order for this to work.

Leave a Reply

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