我有三个域domain1.com
,domain2.com
和domain3.com
都指向我的天蓝网络应用mysites.azurewebsite.net
。在我的azure网站的根文件夹中,这些文件夹中安装了三个文件夹domain1
,domain2
和domain3
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
。
如果永久链接更改为用户友好的网址mydomain1.com/about-us
因为每个子文件夹都有wordpress而无法正常工作,而在wordpress中我启用了固定链接。否则它工作正常
答案 0 :(得分:3)
I don't have a full answer for you, but the stopProcessing="true" on every rule may be causing you some grief, because it stops the rules from being processed further, so your second and third rules will be ignored when you set this flag on the first rule.
You also have your pattern set to match "*\" on all three rules, so perhaps a rule like this could work:
<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>