WordPress URL Rewrite Issues in IIS

This issue occurs every time I set up WordPress with Permalinks and URL Rewrite. So I am going to post a quick fix.

When images are uploaded to WordPress and an attempt to access the image directly is made, the image does not download and instead returns an error 500.

There are two solutions which I have discovered for this and I shall share with you both.

Solution 1

If you have administrator access to your web server, look for the location of the temp folder in PHP.ini. By default this points to C:\Windows\Temp\. You will need to give your application pool account modify access to this folder. After doing so, you may need to re-upload the images causing you problems.

Solution 2

If you do not have administrator access to your web server, you will need to carry out the following steps

  1. Create a new folder under your WordPress installation directory
  2. Modify the permissions to match your wp-content folder
  3. Add the following line to your wp-config.php file
    • define(‘WP_TEMP_DIR’,‘C:\websites\wordpress\temp\’);
  4. Replace C:\websites\wordpress\temp\ with the full path of the folder you just created.


This solution may also apply to Linux servers, however I have not tested it myself.


Hello world!

Welcome to my blog. This blog is a mixture of my own personal knowledge base and things I would like to share with the world. Therefore there may be duplicates of things already posted online.

This blog has been through numerous releases and versions over the past 5 years or so and I don’t feel that anything which was previously was worth migrating across to my new server.

Enjoy the read, hopefully you will find something on here that will be relevant to you in some way or another.