1

I'm hosting a Rails app on Heroku, using the Zerigo DNS. I've added both www.mydomain.com and http://mydomain.com.

My question is this: what is the best way to add a redirect so that http://mydomain.com redirects to www.mydomain.com? Would it be better to add the redirect on Zerigo? Or write some code in Rails to do the redirecting?

Any thoughts are much appreciated.

4

2 回答 2

3

using DNS, just point your root domain to redirect to the www. subdomain.

http://www.zerigo.com/blog/2009/07/dns_updates_url_redirection_and_example_code_for_the_api

also

https://stackoverflow.com/a/12325021/1251349

于 2013-06-04T20:40:37.897 回答
1

Add a CNAME record with www host and simply point it to your http://whateverapp.heroku.com

It works for me perfectly!

于 2013-06-04T20:31:36.587 回答