Last Updated on May 19, 2017
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.
John started JSnowCreations as a place to post random tech guides and product reviews. However, while shopping for his daughter’s first “big girl” bed in 2019 he learned about the hidden dangers of fiberglass in mattresses. Since then, John has made it his mission to expose as much hidden fiberglass in mattresses as possible. His ultimate goal is federal regulations that ban fiberglass from being used in mattresses, or at least a law that require it to be listed in the material tags.