Azure的网站301重定向 - 从哪里我把它? [英] Azure Website 301 Redirect - Where Do I Put It?

查看:157
本文介绍了Azure的网站301重定向 - 从哪里我把它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想直接我的一些其他领域的哪个是在Windows Azure的网站托管我的主域。

I want to direct some of my other domains to my primary domain which is hosted at a Windows Azure website.

(对于那些着想的找到CNAME的工作和DNS有点云里雾里(像我一样)我要去布局的细节。)

我有域 www.myDomain.com 正确地解析。

我现在想点 www.myOtherDomain.com到www.myDomain.com

在我的注册我创建了一个CNAME指向

www.myOtherDomain.com到myInternalAzureSite.azurewebsite.net

然后成功配置它在在Azure的网站域管理工具。

At my registrar I have created a CNAME to point
www.myOtherDomain.com to myInternalAzureSite.azurewebsite.net
and then successfully configured it in the in the Azure Website domain manager tool.

现在,当我输入 www.myOtherDomain.com 到浏览器在我得到适当的网页 www.myDomain.com ,然而,在浏览器的地址仍然是 www.myOtherDomain.com 不是 www.myDomain.com 根据需要。

Now, when I enter www.myOtherDomain.com into a browser I get the proper web page at www.myDomain.com, however, the address in the browser is still www.myOtherDomain.com not www.myDomain.com as desired.

我了解两个最可取的方式来做到这一点要么是:

I understand the two most desirable ways to accomplish this are either:


  1. 转发 myOtherDomain.com (其中一些注册费用$)

  2. 请301永久重定向

  1. Forward myOtherDomain.com (which costs $ at some registrars)
  2. Do a 301 permanent redirect

如果我有所有正确的,我已经找到了如何以做301重定向,但是,我似乎无法弄清楚许多建议WHERE 以实际把重定向?

If I have all that correct, I have found many suggestions of HOW to do the 301 redirect, however, I can't seem to figure out WHERE to actually put the redirect?

推荐答案

Windows Azure的网站上投放IIS。您可以使用URL重写创建规则的一个URL重写到另一个。

Windows Azure Websites run IIS. You can use URL rewriting to create rules to rewrite one URL to another.

说明:


  1. 创建一个Windows Azure网站。

  1. Create a website in Windows Azure.

在比例部分,选择共享或标准的网站模式,并保存更改。

In the Scale section, select a web site mode of Shared or Standard and save changes.

在配置部分,对域名组,加上旧域名(或名称)和新域名并保存更改。

In the Configure section, on the domain names group, add the old domain name (or names) and the new domain name and save changes.

在您的域名注册商或DNS提供商旧域名和新域名,更改DNS记录指向新的Windows Azure网站。使用CNAME(别名)记录,并指向该网站的Windows Azure上域,就像这样:mywebsite.azurewebsites.net

In your domain registrar or DNS provider for the old domain and the new domain, change the DNS records to point to the new Windows Azure Website. Use a "CNAME (Alias)" record and point it to the website's domain on Windows Azure, like this: "mywebsite.azurewebsites.net."

上传您的新网站的内容到Windows Azure。

Upload your new website's contents to Windows Azure.

在新网站的根目录,创建一个名为的Web.config 文件,像这样的内容:

In the root of the new website, create a file named Web.config with a contents like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Redirect old-domain to new-domain" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^www.old-domain.com$" />
                    </conditions>
                    <action type="Redirect" url="http://www.new-domain.com/{R:0}" redirectType="Permanent" />
                </rule>              
            </rules>
        </rewrite>
    </system.webServer>
</configuration>


  • 验证,任何请求 http://www.old-domain.com/path?query ,将收到 HTTP 301永久移动与Location头响应://www.new-domain .COM /路径?查询

    有关文档,请参阅使用URL重写模块

    有关实例参考<一个href=\"http://itmeze.com/2011/04/07/redirect-to-new-domain-after-rebranding-with-iis-url-rewrite-module\">Redirect新域与IIS URL重写模块并更名后的IIS URL重写 - 重定向多个域名一个

    For examples refer to Redirect to new domain after rebranding with IIS Url Rewrite Module and IIS URL Rewrite – Redirect multiple domain names to one.

    这篇关于Azure的网站301重定向 - 从哪里我把它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆