繁体   English   中英

多域指向根文件夹需要根据web.config中的域名指向子文件夹

[英]Multiple domain pointing root folder need to point subfolders according to domain name in web.config

我有三个域domain1.comdomain2.comdomain3.com都指向我的azure web应用程序mysites.azurewebsite.net 在我的azure网站的根文件夹中,三个文件夹可用domain1domain2domain3 ,这些文件夹上安装了wordpress 目前我在web.config给出了以下设置,它指向相应的文件夹。

           <rule name="domain1" stopProcessing="true">
                <match url=".*"/>
                    <conditions logicalGrouping="MatchAny">
                        <add input="{HTTP_HOST}" pattern="^(www.)?domain1.com"/>
                    </conditions>
                <action type="Rewrite"  redirectType="Permanent" url="\domain1\{R:0}" />
            </rule>
             <rule name="domain2" stopProcessing="true">
                <match url=".*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^(www.)?domain2.com" />
                        <add input="{PATH_INFO}" pattern="^/domain2/" negate="true" />
                    </conditions>
                <action type="Rewrite" url="\domain2\{R:0}" />
            </rule>
             <rule name="domain3" stopProcessing="true">
                <match url=".*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^(www.)?domain3.com" />
                        <add input="{PATH_INFO}" pattern="^/domain3/" negate="true" />
                    </conditions>
                <action type="Rewrite" url="\domain3\{R:0}" />
            </rule>

我正面临的问题是,当我点击任何子页面链接时,它将显示以下错误

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

当我从我的wordpress管理员禁用用户友好的URL(永久链接),然后它工作正常。 但它显示为关于我们页面的mydomain.com/?page_id=1

如何在永久链接更改为用户友好的URL(如mydomain1.com/about-us后才能使其正常工作

不工作,因为每个子文件夹都有wordpress和wordpress我启用了固定链接。 否则它工作正常

我没有给你一个完整的答案,但每条规则上的stopProcessing =“true”可能会让你感到悲伤,因为它会阻止规则进一步处理,所以当你设置时你的第二和第三条规则会被忽略这个标志在第一条规则上。

您还可以将模式设置为在所有三个规则上匹配“* \\”,因此这样的规则可能有效:

<rules>
   <rule name="Domain2">
      <match url="*.domain2.*" />
      <conditions>
         <add input="{UrlDecode:{QUERY_STRING}}" pattern="domain2" />
      </conditions>
      <action type="Rewrite" url="{HTTP_HOST}/domain2/" />
   </rule>
</rules>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM