Windows Azure的:如何301非www网址到www的域名 [英] Windows Azure: How to 301 non-www url to www for a domain

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

问题描述

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

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.

我说我要补充的DNS设置,指向一个A记录到Windows Azure的当前虚拟IP的文章之一读取。我如何得到我的Windows Azure部署当前虚拟IP?

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?

还是有301重定向没有更好的办法的所有非www网址到www?

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

议决:我能够通过简单的配置网站重定向DreamHost的DNS设置,设置来解决这个问题。一个简单的301重定向 http://coziie.com 来www.coziie.com整理出来的问题。

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.

首先是设置,使您的未封为网址作品DNS记录。二是要重定向的URL,如果该网站是通过它访问。

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.

更新我已删除了CNAME从这里,因为我在这之前你不能在根域设置为CNAME记录没有意识到previous建议。这似乎与天青的IP限制你将不得不在非湛蓝,asp.net托管指向根域记录,然后把301重定向(如一个进一步下跌我的答复),以转发到Azure的网域(www域)。

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).

当你 http://coziie.com/ 指向你的网站,提供该页面的话时间来解决这个问题,因为谷歌可以感到困惑,认为它的两个不同的网站,然后淡化两者之间您的网页排名。

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.

关键是要建立一个301重定向。我相信,URL重写工具,开始了作为IIS7的插件,但现在已经包含在里面?您可能需要做一个快速搜索。

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.

无论如何,这是我要做的事与安装了官方的URL重写扩展(这正好在你的web.config)的IIS7服务器上:

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网址到www的域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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