Solving Problems with WordPress on Windows Server (IIS)

As a follow up to my article about Installing WordPress on IIS, here are a few tips on fixing common problems with running WordPress on Windows Server.

See the previous article here

Slow Page Loading

If you think your pages load slowly especially without catching turned on you can try to change the following settings.  I would recommend that you make this change regardless of whether you think it makes a difference or not. Open the wp-config.php file in the root of the WordPress installation folder. Locate the following line of code:

define(‘DB_HOST’, ‘localhost’);

Change this code to the following:

define(‘DB_HOST’, ‘’);

As an alternative, you can modify your host file and do the same thing.  Right click on notepad, or your favorite text editor, and “Run as Administrator”.  Now go to “File – Open” and browse to C:\windows\system32\drivers\etc and open hosts.  You will need to change your file selection drop-down in notepad from *.txt to *.* so you will see hosts.

Find the two lines below and remove the # from the beginning of these two lines to make them active and save the file.

#  localhost
# ::1  localhost

Your file should now have these two lines at or close to the bottom of the file.  There will be a lot of lines at the top that starts with #.  Do NOT remove the # from these lines.  localhost
::1  localhost

The reason for the increase in speed is because by default the hosts file in most Windows installations has the mapping to localhost disabled, so it has to hit DNS each time and figure out the IP address that localhost resolves to.  The is for IPV4 and  ::1 is for IPV6.

Some installations may have this file named hosts.sam. If yours is named this then you must rename it to hosts as hosts.sam is a sample file and is NOT read by Windows.  Change your file explorer view to “show extensions for known file types” or browse to this directory via a CMD prompt to make sure you have this correct.

Maximum File Upload Size

If you tried to upload an image or file to your WordPress site you may have run into an error like “File too large!” or “Upload failed” or “This file exceeds the maximum upload size for this site”. If you have not yet encountered this error, chances are you will at some point.  Your max upload and posts size are usually very small unless you or a plugin has modified them already.  The defaults for a lot of people is set to 2 megabytes. For most users, this is insufficient. This is also an easy fix.

Locate the folder PHP was installed in.  Open php.ini and locate the following line:

upload_max_filesize = 2M  (This 2M may be something else).

Change it to the following:

upload_max_filesize = 128M (or whatever size you need it to be)

Also, find the following line:

post_max_size = 2M  (This 2M may be something else).

Change it to the following:

post_max_size = 128M (or whatever size you need it to be)

Restart your server or IIS service for these changes to take effect. Now your max upload and post size have been increased to whatever you specified on those two lines.

IIS Folder Permissions

There are a couple of folder permissions that can cause a variety of errors with WordPress on a Windows server.  Let’s check those and change them if needed.

Open Windows Explorer and locate the root folder where you have WordPress installed. Right-click this folder, select Properties and click the Security tab. Check and see if IIS_IUSRS exists and that they have the three permissions listed below.  If it is not there, choose Edit then Add.  If you have trouble adding IIS_IUSRS see further down for help.

If you try to add IIS_IUSRS you may run into the following error.

If so, click on the Locations button and choose the server that is listed at the top of the box.

Click OK and you should be able to add this user now and set the appropriate permissions.

WordPress will need special permissions in order to update itself, install plugins and themes, upload pictures, remove session information, and other file writing functions.

Open Windows Explorer and locate the root folder that WordPress is installed in and find the wp-content folder. Right-click this folder, select Properties and click the Security tab.  Check and see if IUSR exists and that they have the permissions listed below.  You should NOT NEED Full control selected.  If it is not there, choose Edit then Add.

Once you have done that, you will need to give the IIS_IUSRS group Read permissions on your “C:\Windows\Temp” folder.

Note: If you have edited your php.ini file and change the upload temp directory then you will need to give IIS_IUSRS group read permissions on that folder instead.

Under some conditions, you may need to give the IIS_IUSRS group modify rights to the “C:\windows\temp” folder or the folder specified in your PHP file. Don’t do this unless there is a need to!

Changing Permalinks Cause 500 Error  –  “500 (Internal Server) Error”

If you changed your permalinks in WordPress/Settings/Permalinks from default to Post Name and saved your changes you may get a message at the top of the page.

“Permalink structure updated. Remove write access on web.config file now!”

You may have read quite a few articles about changing the .htaccess file and tried in vain to fix it that way.  Well, IIS does not use that file and this method won’t fix your problem if you are running Windows Server.  You will need to find your web.config file and fix the issue or rename it (don’t delete it) and create a new one.  This file should be in the root of your WordPress folder. A plain web.config is listed below.  This should get you back into your site, but more than likely there are setting in your current file that you need such as rewrite rules.

<?xml version="1.0" encoding="UTF-8"?>
                <rule name="Main Rule" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    <action type="Rewrite" url="index.php" />

If you are using the Rewrite module then this web.config may work for you.

<?xml version="1.0" encoding="UTF-8"?>
        <add value="index.php"/>
        <add value="default.php"/>
                <rule name="WordPress Rule 1" stopProcessing="true">
                    <match url="^index\.php$" ignoreCase="false" />
                    <action type="None" />
                <rule name="WordPress Rule 2" stopProcessing="true">
                    <match url="^wp-admin$" ignoreCase="false" />
                    <action type="Redirect" url="wp-admin/" redirectType="Permanent" />
                <rule name="WordPress Rule 3" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                    <action type="None" />
                <rule name="WordPress Rule 4" stopProcessing="true">
                    <match url="^(wp-(content|admin|includes).*)" ignoreCase="false" />
                    <action type="Rewrite" url="{R:1}" />
                <rule name="WordPress Rule 5" stopProcessing="true">
                    <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:2}" />
                <rule name="WordPress Rule 6" stopProcessing="true">
                    <match url="." ignoreCase="false" />
                    <action type="Rewrite" url="index.php" />

Incorrect time on your site

First, make sure your server has the correct time.  Second, go to your Admin Dashboard and click on Settings then General.  Next, locate the Timezone drop-down button and set it to the correct timezone.  You will see the current date and time below so you can make sure you select the correct one. Be sure to save your settings at the bottom of the page.

403 – Forbidden: Access is Denied


The URL Rewrite module can cause issues with your Distribution Points in SCCM. If you receive this error make sure to check your sites in IIS and remove any Rewrite rules under your Distribution Point’s folders. Click on each path on the left and click on URL Rewrite and delete any rewrite rule you find.

MySQL Bin Files Eating Lots of Disk Space

Q. I get a large number of bin files in the MySQL data directory called “server-bin.n” or mysql-bin.00000n, where n is a number that increments. What is MySQL Binary Log? How do I stop these files from being created?

A. Usually /var/lib/mysql stores the binary log files. (ProgramData\MySQL\MySQL Server 8.0\data on Windows) The binary log contains all statements that update data or potentially could have updated it. For example, a DELETE or UPDATE which matched no rows. Statements are stored in the form of events that describe the modifications. The binary log also contains information about how long each statement took that updated data.

Disable MySQL bin logging

If you are not replicating, you can disable bin logging by changing your my.ini or my.cnf file. Open your my.ini or /etc/my.cnf (/etc/mysql/my.cnf)  (ProgramData\MySQL\MySQL Server 8.0\ on Windows).

Find a line that reads “log_bin” or “log-bin” and remove or comment out the line. Then add the line disable_log_bin and save it.

#log_bin                        = /var/log/mysql/mysql-bin.log

You also may want to remove or comment the following lines:

#expire_logs_days        = 10
#max_binlog_size         = 100M

Close and save the file.

Delete the bin files to reclaim your space.

Finally, restart mysql server:

Internal Server Error 500.50

In a web browser you will just see 500 – Internal server error.  If you try from a browser physically on the WordPress server, you will see HTTP Error 500.50 URL Rewrite Module Error.

If you get this error when you are trying to access a file that you uploaded to your WordPress site here are some things to check.

When you upload a file, PHP sends the file to a temporary directory on your server’s hard drive (usually C:\Windows\Temp) and then copies it over to the proper directory. The file will get its security permissions from the temporary directory. In other words, it gets the permissions of that directory. The problem is when Windows moves that file to the WordPress uploads folder, it keeps the temporary directory’s permissions and you get an error because WordPress can’t read the file.

There are a couple of ways to fix this issue.

1) You can change the temporary directory to a folder within your WordPress installation, usually wp-content/upgrade.

To do this, follow these directions:

Find your php.ini file. Find the upload_tmp_dir line and change it to the wp-content/upgrade folder. Browse to this folder and verify that the permissions are set properly. You should then have the ability to view any new file you upload on your WordPress site. You’ll will probably need to select all the previous uploaded files and change the permissions of the files so that IIS_USRS has at least read access to the file.

If you can’t upload any files at all, it’s probably because you need to give the IUSR account Read/Write/Modify permission on your wp-content folder. This will allow you to upload files and download and install WordPress & plugin updates.

Once you have done that, all you need to do is give the IIS_IUSRS group Read permissions on your “C:\Windows\Temp” folder.

Make sure to notice that the two permission changes you make are not for the same user/group. Give IUSR permissions on your wp-content folder and IIS_IUSRS permissions on your Windows temp folder.

2) You can just change the permissions on C:\Windows\temp and give IIS_IUSRS read permission.

About The Author

I have worked in the computer repair field since the early '90s. I was a technician and then Coordinator of Computer Repair for Regional Education Service Agency II (RESA 2) for 18 years. I currently work for Wayne County Schools as a Network Engineer/Technology Specialist. I am responsible for the schools' Internet access, Wi-Fi, networks, servers, laptops, desktops, and operating systems and software.

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *

42 − 32 =