Amazon Route 53 设置和 301 重定向设置 [英] Amazon Route 53 setup and 301 Redirection setup

查看:22
本文介绍了Amazon Route 53 设置和 301 重定向设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 Amazon EC2 服务器上设置了我的站点.我正在使用 Route 53,当我在 Godaddy 上设置它们时,服务器 DNS 已经正确传播.我有几个问题.在最终结果我想让 301 从 WWW 重定向到非 www(从 www.domain.com 到 domain.com).我希望该重定向适用于所有路径(即 www.domain.com/folder/到 domain.com/folder).

I've setup my site on Amazon EC2 server. I am using Route 53 and the servers DNS have already propagated correctly when I set them on Godaddy. I have a few problems. AT the end results I want to make 301 redirect from WWW to NON-www (from www.domain.com to domain.com). I want that redirection to be applicable to all paths (ie. www.domain.com/folder/ to domain.com/folder).

在我当前的配置中,我为 domain.com 设置了 A 记录,以指向我为我的服务器分配的弹性 IP 地址.当我将 domain.com(不带 www)放在 URL 中时,它运行良好并且站点加载.我还将 www.domain.com 设置为 A 记录以指向相同的 IP 地址.

In my current configuration I've setup A record for domain.com to point to the Elastic IP address that I've assigned for my server. When I put the domain.com (without www) in the URL it works great and the site loads. I've also setup the www.domain.com as A record to point to the same IP address.

在 IIS7.5 中,我设置了重定向规则(在我安装了URL 重写"IIS 模块之后.

In IIS7.5 I've set up a Redirection rule (after I've installed the "URL Rewrite" IIS module.

这是规则:

Request URL: Matches the Pattern
Using: Wildcards
Pattern: (.*)
Logical grouping: Match All
Input {HTTP_HOST}
Type: Matches the PAttern
Pattern: www.mydomainname.com.com
Action Type: Redirect
Redirect URL: mydomainname.com{R:1}
Redirect Type: 301

当我使用www"运行我的网站时,它会返回 www.mydomain.com/mydomain.commydomain.commydomain.com 等...

When I run my site with 'www' it returns www.mydomain.com/mydomain.commydomain.commydomain.com ,etc...

我不知道问题出在 URL 重写、Route 53 设置还是两者都有.我想正确设置 Route 53 和重定向规则,以便我的站点将所有 www 请求重定向到非 www URL.此外,我想知道在 Route 53 中为 www 和主域使用 A 记录是否是一个好习惯.

I don't 'know if the problem is with the URL rewrite, Route 53 settings or both. I want to setup the Route 53 and Redirection rules correctly so my site will redirect all www request to non-www URLs. Furthermore, I wanted to know if it's a good practice to use A record for both www and the main domain in Route 53.

更新:我删除了重写规则,它仍然返回那个长网址.

update: I removed the rewrite RULE an it still returns that long url.

update2: 我为 www 创建了一个 CNAME 并将其指向 EC2 服务器的公共 DNS,www 现在可以工作了.但我仍然需要 www 到非 www 的重定向规则.

update2: I created a CNAME for www and pointed it to the public DNS of the EC2 server and www now works. But I still need the www to non-www redirection rule.

谢谢

推荐答案

在 Route53 中,您可以设置一个 PTR(指针)记录,从 www.yoursite.comyoursite.com.这是我用来设置从 mydomain.comwww.mydomain.com

In Route53 you could set up a PTR(Pointer) Record to go from www.yoursite.com to yoursite.com. This is what I use to set up redirection from mydomain.com to www.mydomain.com

这篇关于Amazon Route 53 设置和 301 重定向设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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