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.
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.
If you do not have administrator access to your web server, you will need to carry out the following steps
- Create a new folder under your WordPress installation directory
- Modify the permissions to match your wp-content folder
- Add the following line to your wp-config.php file
- 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.