Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to write web.config for wordpress on iis with non latin url

I am using wordpress wirh permalink structure (/%year%/%monthnum%/%day%/%postname%/) on iis server.

The issue is with non-latin characters like malayalam.

I wrote the web.config as follows,

<?xml version="1.0" encoding="utf-8"?>
<configuration>

<system.web>
<httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" relaxedUrlToFileSystemMapping="true" AllowRestrictedChars="1" UrlSegmentMaxLength="2048" />
<pages validateRequest="false" />

</system.web> 

<system.webServer>

<security>
<requestFiltering allowDoubleEscaping="true" />
</security>

<rewrite>
<rules>
<rule name="WordPress Rule" stopProcessing="true" >
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?page={R:0}" />
</rule>
</rules>
</rewrite>

</system.webServer>
</configuration>

Posts page goes to date archive.How to fix this?

like image 630
Vidhu Avatar asked Dec 06 '25 23:12

Vidhu


1 Answers

Just add the code below in your index.php file in your site root directory:

    if (isset($_SERVER['UNENCODED_URL'])) {
    $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
}

Your web.config needs to be like this:

 <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
            <rule name="WordPress: http://yoursite" patternSyntax="Wildcard">
                <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>
like image 103
Sabouei Alireza Avatar answered Dec 09 '25 18:12

Sabouei Alireza