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.