Default WordPress URL looks like http://mydomain.com/?p=123, which is not a user-friendly SEO URL. So, to create SEO-friendly URLs, you can use WordPress Permalinks. After enabling the Permalinks, you will see the category, tag, title, and post in the URL while also using keywords inside the URLs. The following steps will help set up WordPress Pretty Permalinks in a Windows Environment Running IIS.
- Log in to your WordPress Admin - https://mydomain.com/wp-login.php.
- Go to Settings >> Permalinks.
- In Common Settings, choose the required permalink structure that you want to use.
Here, we have selected the post name commonly used by SEO experts; the post name is the unique identifier to locate your WordPress post from the database.
WordPress custom structure will also allow you to structure your website URL. - Once you select the version, remove the /index.php and only add /%postname%/ and click the Save Changes button.
In this case, if your WordPress page is named blog.php, it will show up as http://mydomain.com/blog/. - Open the web.config file in IIS.
It is an equivalent file of .htaccess in Linux cPanel. You can use FTP to access the web.config file or directly connect using the RDP. - You can create the web.config file if it doesn't exist and add the code given below within your web.config file -
-
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress Rule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
-
7. Save the file if you have connected it through RDP.
You must save and upload this file if you use FTP.
8. Access your WordPress website; now, it should show the page we discussed in point number 4.