azure - 如何对搜索引擎隐藏 azure vm 技术 url?

标签 azure virtual-machine search-engine

我在 Azure 虚拟机中有一个项目,其技术地址为“myproject.cloudapp.net”,域为“myproject.com”。搜索引擎已经在搜索结果中索引了技术地址(myproject.cloudapp.net)和我的项目以及技术地址。

如何对搜索引擎隐藏azure vm地址(*.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,并且我通过添加一个全局过滤器来进行重定向,该过滤器会执行更多检查。

关于azure - 如何对搜索引擎隐藏 azure vm 技术 url?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25377293/

相关文章:

c# - ASP.NET MVC5 Elmah 错误日志/电子邮件找不到路径的 Controller

Azure 表存储异常信息

c# - 使用通过 Azure MSI 获取的 token 从 TokenCredential 创建 Azure CloudStorageAccount

c# - 操作在 azure 认知上返回无效状态代码 'unauthorized'

java - 如何使用最新的 SDK 启动 Azure VM 异步

php - 松散的搜索方法

node.js - Azure 网站上的 iisnode 和 cors

docker - 安装 Docker 后 Vagrant 挂载错误

iis - Azure虚拟机: Can't access/ping port 80

search - Elasticsearch 输入分析