[英]resolving rails subdomain with heroku
我有一个包含博客和单个页面网站的应用程序,它们都在同一个应用程序中
博客是应用程序的根源,而单页网站只是应用程序的另一部分。
routs.rb includes
match '/pages' => 'pages#home'
root :to => 'blogs#index'
该应用程序托管在heroku上,并且运行良好:(我是通过将应用程序托管在heroku上并将dns指向heroku来实现的,即heroku的网址是fxyear.herokuapp.com,我买了fxyear.com并将其指向herokuapp.com,它完美地工作。
我要实现的是我希望一个子域指向heroku,这样www.summit.fxyear.com将指向页面,即匹配'/ pages'=>'pages#home',这一切都非常感谢
CNAME
您必须更改您的域的ANAME或CNAME设置 ,以便summit.fxyear.com
子域将指向您的Rails应用程序(Heroku应用程序)。
然后,您可以在路线中使用约束 :
#config/routes.rb
constraints subdomain: "summit" do
get "", to: "pages#home"
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.