locked
Two language WordPress sites on IIS - rewriting problem RRS feed

  • Question

  • User1403157493 posted

    Hi,

    I install Wordpress site in IIS root folder (C:\inetpub\wwwroot).

    This is main web site (http://wordpress/) in English language. 

    I wrote rewrite rule in web.config

        <rewrite>
            <rules>
                <rule name="wordpress" 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>

        </rewrite>

    And I set in wordpress setting > permalink to post.

    It work great, redirection is going to http://wordpress/_the_post_name . Everything works perfectly.

    After that I have a new installation of Wordpress site in new folder (C:\inetpub\wwwroot\hr).

    This is new wordpress web site (http://wordpress/hr) in Croatian language.

    I wrote a new rule, in root folder inside web.config:

            <rule name="wordpress-hr">
               <match url="hr/*" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
               <action type="Rewrite" url="hr/index.php" />
            </rule>

    And that rule, when is the only one in web.config, works just fine.

    Now I have redirection like http://wordpress/hr/_the_post_name .

    And my problem is that those two rules do not work together in same web.config.

    Those rules works fine for English folder when there is only first rule in web.config or works fine for Croatian folder when second rule is only one in web.config.

    I tried to place first rule in web.config inside root folder and second rule in web.config inside of "hr" folder.

    I do not know what do I need to adapt in those rules so they can work properly in the same web.config file.

    I suppose that first rule "override" second but I do not have clue how to exclude "hr" folder from the first rule.

    Any help?

    Wednesday, March 3, 2021 10:52 AM

All replies

  • User1771714573 posted

    Hi Tomislav B,

    This is new wordpress web site (http://wordpress/hr) in Croatian language.

    Is the website written in Croatian or is the file or folder name in Croatian? I tried to reproduce the issue but I don't know Croatian language.

    If the name of file or folder is in Croatain, url rewrite rule may cannot work. IIS is only applicable when the file name is English. If the website written in Croatian but name is English, the rule still cannot work, maybe something wrong with rule. You can use failed request tracing to check the process of rewrite, it will show you what went wrong.

    Best regards,

    Brucz

    Thursday, March 4, 2021 2:31 AM