Today I came across something different however; Putting a WordPress site live on a Windows IIS Server. It was running PHP and MySQL so that wasn’t a problem, however a couple of additional problems did arise as I explain below…

Default File Type

The first problem was that the Windows server wasn’t looking for a file called ‘index.php‘ by default. It was probably looking for an ‘index.html‘, or an ‘index.asp‘ file instead. Either way, I needed a way to tell the server what the default file was when navigating to the root of the site in a browser.

Allow me to introduce to you the ‘web.config‘ file…

I’ll admit, I didn’t know this before today, but Windows servers don’t acknowledge the .htaccess file we’re so familiar with when working in an Apache environment. As a result, Windows servers have their own similar file simply called ‘web.config‘. Like a .htaccess file, this XML file sits in the relevant directory, and can perform much of the same operations.

Getting back on track, you need to set the default file in this web.config file, and can do so like so:

As you can see above, we are setting ‘index.php‘ to be the default file.

Removing index.php From The Permalink

The next problem I faced was that, because the .htaccess file was being ignored, the mod_rewrite rules weren’t working, and therefore I had to keep ‘index.php’ in the URL for the inner pages to function. Again, this can all be controlled from within our ‘web.config‘ file. Whereas your .htaccess might look something like this: