解决GitHub Pages的302转向问题

2014-05-14
1 min read

起因

NOTE: 如果给GitHub Pages使用的是子域名,按照GitHub Pages文档配置,不会出现该问题。

由于我在GitHub Pages上的搭的博客使用了theo.im这个根域名(Apex Domain),在按照 GitHub Pages文档上提供的信息,对theo.im设置了A记录,但是通过执行命令:

curl -I http://theo.im/sitemap.xml

发现得到的是302转向,不符合Sitemap协议的要求:

A successful request will return an HTTP 200 response code; if you receive a different response, you should resubmit your request. The HTTP 200 response code only indicates that the search engine has received your Sitemap, not that the Sitemap itself or the URLs contained in it were valid.

解决

通过搜索,我发现需要使用ALIAS记录解析根域名,但是由于我之前使用的是DNSPod 的服务,不支持ALIAS记录,因此决定换加DNS域名解析商。

经过一番搜寻,找到了两家支持ALIAS记录的DNS域名解析商:

  1. DNSimple: 全收费服务
  2. PointDNS: 有免费的开发者账户

本着能用收费不用免费的原则,因此我选择了 DNSimple 来解析我的域名 (゜o゜(☆○=(-_-)

OK,万文不如一图:

最后,运行 dig theo.im +nostats +nocomments +nocmd 检查DNS是否生效:

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> theo.im +nostats +nocomments +nocmd
;; global options: +cmd
;theo.im.           IN  A
theo.im.        3600    IN  A   199.27.79.133
comments powered by Disqus