Windows Azure:如何将301的非www url转到www为域 [英] Windows Azure: How to 301 non-www url to www for a domain

查看:181
本文介绍了Windows Azure:如何将301的非www url转到www为域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近通过DreamHost门户部署了Windows Azure应用程序并配置了我的域的DNS。现在,我的网站可通过 http://www.coziie.com 访问,但不能通过非www地址访问。 / p>

我读了一篇文章,我应该在DNS设置中添加一条记录,并指向Windows Azure的virutal IP。如何获得Windows Azure部署的恶意IP?



或者有更好的方法来将所有非www网址重定向到www?



RESOLVED :通过在DreamHost DNS设置中简单配置网站重定向设置,我可以解决这个问题。 http://coziie.com 到www.coziie.com的简单301重定向整理了这个问题。

解决方案

您正在谈论两个单独的问题。



首先是设置一个DNS记录,以便您的非标准URL可以工作。第二个是重定向网址,如果网站被访问。



更新我已经删除了以前对CNAME的建议,因为我之前没有意识到您无法将根域设置为CNAME记录。看来,随着Azure的ip限制,你将不得不指出根域名记录在非天蓝色的asp.net主机,然后把一个301重定向(比如我的答复进一步)转发到Azure域(www域)。



当您有 http://coziie.com/指向您的网站,并提供该网页,然后再解决这个问题,因为Google可能会感到困惑,认为它的两个不同的网站,然后稀释两者之间的页面排名。



诀窍是设置一个301重定向。我相信url重写工具开始作为IIS7的插件,但现在包含在其中?您可能需要快速搜索。



无论如何,这是我如何在IIS7服务器上安装官方url重写扩展名(这在你的web.config):

 < system.webServer> 
< rewrite>
< rules>
< clear />
< rule name =WWW Rewriteenabled =true>
< match url =(。*)/>
<条件>
< add input ={HTTP_HOST}negate =truepattern =^ www\。/>
< / conditions>
< action type =Redirecturl =http:// www。{HTTP_HOST} / {R:0}appendQueryString =trueredirectType =Permanent/>
< / rule>
< / rules>
< / rewrite>
< /system.webServer>

Intellisense将抱怨说它不是一个被认可的元素,但这只是一个化妆品问题,而你正在编辑文件。


I recently deployed an Windows Azure application and configured DNS of my domain through DreamHost portal. Now my site is accessible through http://www.coziie.com, but not through non-www address.

I read in one of the articles that I should add an A record in DNS settings and point to virutal IP of Windows Azure. How do I get virutal IP of my Windows Azure deployment?

Or is there any better way to 301 redirect all non-www urls to www?

RESOLVED: I was able to solve this problem by simple configuring a website redirect settings in DreamHost DNS settings. A simple 301 redirect of http://coziie.com to www.coziie.com sorted out the issue.

解决方案

You are talking about two separate issues here.

The first is to setup a DNS record so that your un-canonised url works. The second is to redirect the url if the site is accessed by it.

update I have removed the previous advice for CNAME from here as I didn't realise before that you cannot set the root domain to a CNAME record. It seems that with the ip restrictions of Azure you will have to point the root domain record at non-azure, asp.net hosting and then put a 301 redirect (such as the one further down my reply) to forward it on to the Azure domain (www domain).

When you have http://coziie.com/ pointing at your site and serving the page its then time to fix this because Google can get confused, think its two different sites and then dilute your page rank between the two.

The trick is to set up a 301 redirect. I believe the url rewriting tool started out as an addon for IIS7 but is now included in it? You might have to do a quick search on that.

Anyway, this is how I do it on an IIS7 server with the official url rewrite extension installed (this goes in your web.config):

  <system.webServer>
    <rewrite>
      <rules>
        <clear/>
        <rule name="WWW Rewrite" enabled="true">
          <match url="(.*)"/>
          <conditions>
            <add input="{HTTP_HOST}" negate="true" pattern="^www\."/>
          </conditions>
          <action type="Redirect" url="http://www.{HTTP_HOST}/{R:0}" appendQueryString="true" redirectType="Permanent"/>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

Intellisense will complain that its not a recognised element but thats just a cosmetic issue while you are editing the file.

这篇关于Windows Azure:如何将301的非www url转到www为域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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