开发者

Best way to redirect all your pages from www to root domain using ruby on rails?

开发者 https://www.devze.com 2023-01-09 12:43 出处:网络
What\'开发者_开发知识库s the best way to redirect all your pages from www to root domain using ruby on rails?Sometimes your host won\'t let you do redirects, so I think it\'s ok practice to do it eith

What'开发者_开发知识库s the best way to redirect all your pages from www to root domain using ruby on rails?


Sometimes your host won't let you do redirects, so I think it's ok practice to do it either in your application_controller or middleware. If you're on Rails3, check out this no-www gem

This SO Question has examples of going from www to no-www and from no-www to www.


Does it have to be in Rails? This is pretty easy to do with Apache, for instance.

http://txt.binnyva.com/2008/09/remove-www-from-url-using-htaccess-in-apache/

0

精彩评论

暂无评论...
验证码 换一张
取 消