我在Azure虚拟机中有一个项目,其中包含“myproject.cloudapp.net”技术地址和“myproject.com”域.搜索引擎已将索引技术地址(myproject.cloudapp.net)和我的项目编入技术地址的搜索结果中. 如何从搜
如何从搜索引擎隐藏azure虚拟机地址(* .cloudapp.net)?
我认为你有一个网络应用程序.您必须创建一个重定向规则来检查所请求的域以及它是否与* .cloudapp.net匹配,然后执行永久重定向到mydomain.com.在web.config中像this answer:
<rewrite>
<rules>
<rule name="Redirect to www" stopProcessing="true">
<match url="(.*)" />
<conditions trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^.*.cloudapp.net$" />
</conditions>
<action type="Redirect"
url="{MapProtocol:{HTTPS}}://www.domain.com/{R:1}" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="MapProtocol">
<add key="on" value="https" />
<add key="off" value="http" />
</rewriteMap>
</rewriteMaps>
</rewrite>
免责声明:我没有在web.config中测试此重定向.我的应用程序正在运行Asp.Net MVC,我通过添加一个全局过滤器进行重定向,该过滤器可以进行更多检查.
