Hello,
As many on this forum, I am not an experienced user of IIS or web servers in general. I am trying to host a WordPress website on my own host (I have full control). I am using Windows Server 2008 R2 and IIS 7. I did get WordPress to work but I have trouble with URL redirection (rewriting). The main page works fine as I have specified index.php as default document; however, subpages such as example.com/page1/ won't work. After doing some research I found out that the problem was in the IIS configuration. Apprantly I have to manually "tell" IIS web server to redirect from example.com/page1/ to example.com/index.php?(...) . I learned that it is done by manually editing web.config file in server root directory. The official WordPress installation on IIS 7 guide mentions a part of configuration that I need to insert, so I did that.
I first made a mistake in file structure (I missed system.webServer node) and IIS manager reported an error with detailed description of what exactly went wrong. After fixing that mistake that same dialog window appears but it doesn't specify any reasons or provide any details. Needless to say, the site doesn't work - status 500 is returned. I checked the file for XML syntax errors and compared and replaced it with sample configurations from the Internet. If I return web.config to its initial state, no error appears in IIS manager and the main page of the website loads fine.
How do I edit web-config properly? Where did I make my mistake?
Thank you for your help and attention.
web.config in server root (no tabs, "UTF-8 without BOM" encoding)
<?xml version="1.0" encoding="UTF-8"?><configuration><system.webServer><rewrite><rules><rule name="Main Rule" stopProcessing="true"><match url=".*" /><conditions logicalGrouping="MatchAll"><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>Screenshot of IIS manager error without descriptions
