Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 如何隐藏';azurewebsites';当网站位于前门后时,来自搜索引擎的url?_Asp.net_.net_Azure_Azure Front Door - Fatal编程技术网

Asp.net 如何隐藏';azurewebsites';当网站位于前门后时,来自搜索引擎的url?

Asp.net 如何隐藏';azurewebsites';当网站位于前门后时,来自搜索引擎的url?,asp.net,.net,azure,azure-front-door,Asp.net,.net,Azure,Azure Front Door,试图阻止Google搜索结果上显示的“azurewebsites”url,通常我只需在web配置中添加重定向规则,如下所示: <rule name="Disable Azure Domain" patternSyntax="Wildcard" stopProcessing="true"> <match url="*" /> <conditions

试图阻止Google搜索结果上显示的“azurewebsites”url,通常我只需在web配置中添加重定向规则,如下所示:

<rule name="Disable Azure Domain" patternSyntax="Wildcard" stopProcessing="true">
          <match url="*" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{HTTP_HOST}" pattern="*.azurewebsites.net" />
          </conditions>
          <action type="Redirect" url="https://www.mysitedomain.org{REQUEST_URI}" redirectType="Permanent" />
        </rule>

然而,当在Azure前门后面的特定站点上使用此重定向时,会导致该站点返回404。我认为前门必须使用azurewebsites的url,所以这不是一个可行的解决方案

欢迎任何建议

我认为前门必须使用azurewebsites的url,所以这不是一个可行的解决方案

事实并非如此。在前门创建后端时,可以选择“自定义主机”,并指定为应用程序服务配置的自定义域。

因此,解决方案如下所示:

  • 用于您的应用程序服务。因此,您的站点将类似于siteA.mysitedomain、siteB.mysitedomain等
  • 将后端添加到前门作为自定义域
  • 最后在web.config中使用重定向规则,如下所示。重定向到前门URL(您也可以在那里)。这将确保即使有人使用.azurewebsites.net URL指向您的网站,他们也会被重定向到前门入口点。最终,搜索引擎将不再使用azurewebsites.net进行索引
  • 
    

    找到了一个相对简单的解决方案,只需在“service Tag”类型的应用程序服务上添加一个IP限制,然后选择AzureFrontDoor。后端

    你也这样做了吗?感谢这个响应,但如果我理解正确,它将需要dns更改,以便将子域绑定到应用程序服务
    <configuration>
      <system.webServer>  
        <rewrite>  
            <rules>  
              <rule name="Redirect rquests to default azure websites domain" stopProcessing="true">
                <match url="(.*)" />  
                <conditions logicalGrouping="MatchAny">
                  <add input="{HTTP_HOST}" pattern="^yoursite\.azurewebsites\.net$" />
                </conditions>
                <action type="Redirect" url="http://www.yoursite.com/{R:0}" />  
              </rule>  
            </rules>  
        </rewrite>  
      </system.webServer>  
    </configuration>