I am trying to run WordPress in Windows Server 2012 R2 and encountered an issue on displaying other WordPress pages except for the WordPress homepage.
The WordPress files are in ex. wordpress folder.
So the sites are accessible in;
example.com/ – this returns successfully the ASP.NET website
example.com/wordpress – this returns successfully the WordPress homepage website
But when I access different WordPress pages, ex.
example.com/wordpress/about-us – I got an error saying
Server Error in ‘/’ Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /wordpress/about-us
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2106.0
*Permalink is already setup with this setting
example.com/wordpress/%postname%
*I also tried doing URL Rewrite on IIS Manager but it is not working. On the ASP.NET web.config it shows:
<rule name=”wordpress” enabled=”true” patternSyntax=”ECMAScript” stopProcessing=”true”>
<match url=”(wordpress/about-us).*” />
<action type=”Rewrite” url=”index.php” />
<conditions logicalGrouping=”MatchAny”>
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” />
<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” />
</conditions>
</rule>
WordPress Version: 5.6
PHP Version: 7.3.24
IIS Version: 8.5
Can someone help me? 🙁
2
Answers
Thank you all so much for responding.
I was creating the Rewrite Rule on the wrong config file. Right now I created it on the “..the same directory where the WordPress files are installed..” as this guide in the link below says.
https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/enabling-pretty-permalinks-in-wordpress
For other’s reference: web.config file path to create Rewrite Rule: ex. C:HostingSpacesASPWebsitewordpressweb.config
WordPress is written in PHP. If you want to run WordPress in a windows machine (e.g. IIS) , you may set Module Mapping in your IIS manager after you have downloaded / installed PHP for windows.
For example, in the IIS Manager’s Actions pane, you will be able to choose “Add Module Mapping.” Enter the necessary details to tell IIS that *.php files should be run by php-cgi.exe through FastCGI.