Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么方便地在beego框架中配置nonwww跳到www的http 301功能(需要考虑到static部分)? #88

Closed
smithfox opened this issue Jul 3, 2013 · 12 comments

Comments

@smithfox
Copy link
Contributor

smithfox commented Jul 3, 2013

所谓nonwww跳到www, 意思是指: baidu.com 会自动跳到 www.baidu.com

@astaxie
Copy link
Member

astaxie commented Jul 3, 2013

这个不是beego能够做到的,这个是你域名的管理里面配置的

@smithfox
Copy link
Contributor Author

smithfox commented Jul 3, 2013

请教怎么在域名管理配置这个?!

CNAME好象搞不定这个

@astaxie
Copy link
Member

astaxie commented Jul 4, 2013

这个我也不清楚,但是我是通过域名管理实现的,beego.me www.beego.me你可以测试一下

@nevernet
Copy link

nevernet commented Jul 4, 2013

不可以自己判断host吗?

------------------ Original ------------------
From: "smithfox"notifications@github.com;
Date: Wed, Jul 3, 2013 10:22 PM
To: "astaxie/beego"beego@noreply.github.com;

Subject: [beego] 怎么方便地在beego框架中配置nonwww跳到www的http 301功能(需要考虑到static部分)? (#88)

所谓nonwww跳到www, 意思是指: baidu.com 会自动跳到 www.baidu.com


Reply to this email directly or view it on GitHub.

@notedit
Copy link

notedit commented Jul 4, 2013

这个需求跟beego 没什么关系 在dns那里设置一个A记录就可以了

另外 @astaxie github的issuees不是论坛 是不是可以规范下

@notedit
Copy link

notedit commented Jul 4, 2013

如果想在应用层做的话 可以用nginx的rewrite

在 2013年7月4日下午1:39,notedit notedit@gmail.com写道:

这个需求跟beego 没什么关系 在dns那里设置一个A记录就可以了

另外 @astaxie github的issuees不是论坛 是不是可以规范下

@astaxie
Copy link
Member

astaxie commented Jul 4, 2013

这个我也控制不了别人提各种需求的issue啊,只能尽力帮大家解决问题吧

@smithfox
Copy link
Contributor Author

smithfox commented Jul 5, 2013

谢谢各位大虾的解答, 我说的这个需求确实需要在web服务端实现(nginx,apache,tomcate,php之类的), 不是和beego完全没有关系的。

添加 A 记录, 只能让 beego.me 可以访问, 但做不到 beego.me 自动跳到 www.beego.me ( beego.me 网站也是不能跳转),我google了一些国外的文章也是说必须要用 301来实现.

@smithfox
Copy link
Contributor Author

smithfox commented Jul 5, 2013

@notedit ,你说: " @astaxie github的issuees不是论坛 是不是可以规范下",

这类问题应该是什么地方反馈呀 :-)

@notedit
Copy link

notedit commented Jul 5, 2013

像stackoverflow这种,国内也有一些技术的论坛 如果你非常急切,可以直接联系作者

其实一般的问题 google 都能解决 善用google

在 2013年7月5日下午6:53,smithfox notifications@github.com写道:

@notedit https://github.com/notedit ,你说: " @astaxiehttps://github.com/astaxiegithub的issuees不是论坛 是不是可以规范下",

这类问题应该是什么地方反馈呀 :-)


Reply to this email directly or view it on GitHubhttps://github.com/astaxie/beego/issues/88#issuecomment-20513242
.

@astaxie
Copy link
Member

astaxie commented Jul 7, 2013

如果你非要302跳转也可以,https://github.com/astaxie/beego/blob/master/docs/zh/Quickstart.md#-6
使用filter,判断所有的request.host,然后实现跳转

@smithfox
Copy link
Contributor Author

smithfox commented Jul 7, 2013

@astaxie , 非常感谢!

@smithfox smithfox closed this as completed Jul 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants