簡體   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