WordPress Installation on IIS with PHP. Pretty URL and Error 404 and 500

If you want to configure WordPress to use Pretty URL.  

  1. Change WordPress—>Dashboard—>Settings—>Permalinks to use “Post name” format.
  2. Make sure your IIS has “URL Rewrite” module installed.
  3. Add the following to your WordPress site’s webconfig.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress Rule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?page_id={R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Note that this is different the instructions from  http://www.iis.net/learn/extensions/url-rewrite-module/enabling-pretty-permalinks-in-wordpress.

After you do this, you may run into broken images problem. 

Quick Fix:

  1. Add IUSR and {serveranme}/IIS_IUSRS with read permission to the uploaded images.

Better Solution:

  1. Search and modify “php.ini” (e.g. C:\Program Files (x86)\PHP\vX.X)
  2. Change “upload_tmp_dir=C:\Windows\Temp” to a folder of your own folder.
  3. Add IUSR and {serveranme}/IIS_IUSRS with full control permission to the new folder.

Special thanks to Amixa Blog’s article for hitting the broken image problem right on the nail.  I could see this taking hours to resolve.

Reference:

http://codex.wordpress.org/Using_Permalinks#Permalinks_without_mod_rewrite

http://www.amixa.com/blog/2011/04/29/iis-wordpress-images-500-error/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s