Topics in the world of web development and other technologies we find interesting.

Blue Valley Technologies - TechTalk

We want to give back! We have learned much of what we use everyday by others that have taken the time to post that information to the web. Here is where we will post the things that we hope will in turn be useful to others as we explore the technologies in web development and any other topics we find interesting.
You are free to use any of the code snips or techniques that we have posted here for any purpose, personal or commercial. However if we credit another individual or group please visit their website for information about their usage terms.

WordPress Pretty Permalink Settings Results in 404 Error on Windows IIS

If you are enabling any of the alternate permalink settings in WordPress (located under Settings -> Permalinks) you may run into the common issue of seeing an ugly  404 - File or directory not found error when trying to view a post. Don't worry, windows IIS does support this ability, it just needs one extra step.

The Solution

According to the WordPress documentation, if you are running IIS 7+, you will need to also have the URL Rewrite 1.1+ module installed as well. This is a pretty standard module and is often already installed. 

What they don't mention however, is that you will need to enable this functionality in your web.config file. Look for this file in the root folder for your wordpress site, and if it does not yet exist, just create it (you can use notepad, but make sure to save the file as web.config, and not the typical .txt extension).

You will need to add the following content:

<?xml version="1.0" encoding="UTF-8"?>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*"/>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
<action type="Rewrite" url="index.php"/>

If you already had a web.config file, just add the tags that are missing, without deleting any of the existing settings.

Posted by Mark at 16:19
Tags :
Categories :

IIS 500 Errors when loading a static image in WordPress

I ran into this problem today and it was a frustrating one to track down. The WordPress site was a very basic blog running on IIS and using the freindly perma-links settings.

When loading a static image that had been uploaded in WordPress the browser would return a 500 error, and the IIS log would show: "GET /wp-content/uploads/2013/10/Sale.jpg - 80 - Mozilla/5.0+(Windows+NT+6.2;+WOW64;+rv:24.0)+Gecko/20100101+Firefox/24.0 500 50 5 46"

I finally found the solution on another blog, posted by iis_isz.  I have copied the solution here to make sure I can find it again in the future, and for anyone else that has the same issue!


Explanation of the Error

The image issue was a permission issue, but simply setting it manually on the original image file or parent folder is inadequate.  The behavior of WordPress is that it writes the original file using IUSR to a temporary system directory that is defined in the PHP.ini file.  This temp folder does not have IIS_IUSRS permissions on it, so when windows moves this file from the temp folder to the application's upload folder, its final home, IIS_IUSRS only has read permissions, so the permissions are not inherited from the file's parent folder.

To fix this, there are two solutions

1. Change the permissions on the temp folder giving IIS_IUSRS write/modify.

2. Change the path of the temp folder in the PHP.ini file to a folder that does have IIS_IUSRS write/modify permission.

Here is a good source detailing the problem:

I chose to move the temp folder in my PHP.ini to C:\inetpub\temp\uploads and also give it permissions.

After uploading an image in wp-admin, I was able to access the image (original, not resized) from a browser wihout the 500.50 error.



Posted by Mark at 12:26
Categories :


Recent Comments

Powered by Disqus Error loading MacroEngine script (file: uBlogsyListBlogRoll.cshtml)