Windows servers mostly create issues with WordPress. One of the most annoying bug is the error in custom permalink structures. WordPress default links don't give you the good SEO, so they are needed to be customized. Apart from this, if you have migrated your blog from Blogger to WordPress, then you need the same permalink structure as your Blogger links there on WordPress to maintain the traffic and SEO of your blog. But when you switch to custom permalinks, it causes errors sometimes and the errors are mostly caused with the windows servers. This is so, because WordPress was designed for Linux operating system originally. The better option to avoid such bugs
is that you should switch to Linux hosting. Still if you love your windows hosting and don't want to leave it, here is a simple solution. Follow the below steps to configure your WordPress blog. This methods works in 99 cases out of 100. Run a custom installation of WordPress on your hosting. If you use the inbuilt installation of applications, and install the WordPress through it, then it causes errors. If you don't know, how to install WordPress manually, follow the below steps. You should have the access to your control panel and file manager to do this. If you already know the installation procedure, then skip this step and scroll down.
How to Install Manually on a Windows Server
- Download the latest WordPress package (.zip)
- Upload the package to your server via any FTP client or through inbuilt uploader of your control panel
- Unzip .zip file, open WordPress folder and transfer all files and folders from unzipped directory to the root directory of your domain
- Go to databases, create a MySQL database and add a user to the created database and note down the details. i.e. database name, user name and password
- Now navigate back to the root directory of your website where you have copied the WordPress files, open wp-config-sample.php and edit the database details in the specified locations in it
- Save the changes and close the editor. Now rename wp-config-sample.php file to wp-config.php
- Open a new browser window and enter your domain name. WordPress installation should initiate once you enter your domain name. If you have copied the WordPress installation files to any sub-directory, enter it to start the installation process
- Follow the instructions and complete the installation
- Your installation should successfully complete
How to Set Custom Permalinks
- Now navigate to the settings in your WordPress dashboard (http://yourdomain.com/wp-admin/index.php) and select Permalinks
- Select your desired permalink structure and click on Save
- WordPress will show you any of the following two messages:
Permalink structure updated. Remove write access on web.config file now!
or
Permalink structure updated. Update web.config file now!
To fix this and enable the custom permalink structure. edit web.config file or create it, if it isn't present in the WordPress installation root directory. To edit this, go to your control panel again and navigate to the directory where you have installed WordPress. Look for web.config file, if you find it, then open it to edit and replace its code with the below provided code. If you don't find any web.config file in the directory, simply create a web.config file. To create a web.config file, open notepad, paste the below code in it, click on 'Save", save as type all files and name it web.config. Then upload this file to the root directory of your WordPress installation. You are all done! Here is the code.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress Rule 1" stopProcessing="true">
<match url="^index\.php$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="WordPress Rule 2" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
<action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
</rule>
<rule name="WordPress Rule 3" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
<action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
</rule>
<rule name="WordPress Rule 4" 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" />
</conditions>
<action type="None" />
</rule>
<rule name="WordPress Rule 5" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
<action type="Rewrite" url="{R:2}" />
</rule>
<rule name="WordPress Rule 6" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
<action type="Rewrite" url="{R:2}" />
</rule>
<rule name="WordPress Rule 7" stopProcessing="true">
<match url="." ignoreCase="false" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
If you still face any difficulty, you can comment on this post. I'll try my best to help you out fixing this issue.