3

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?

Vidhu
  • 79
  • 1
  • 5

2 Answers2

3

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>
Sabouei Alireza
  • 97
  • 1
  • 10
  • 1
    Please insert the relevant parts of that manual page here, as your answer will get useless otherwise if the content is changed or removed – Nico Haase Feb 23 '18 at 11:12
0

Quoted code below from link user Sabouei Alireza mentioned. Credits to him if answer is not updated.

Add the code after first opening PHP tag

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

You will also need to have properly configured web.config in order to allow WordPress pretty permalinks

<?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>
ZF007
  • 3,708
  • 8
  • 29
  • 48