【问题标题】:resolving rails subdomain with heroku用heroku解析rails子域
【发布时间】:2014-07-31 08:21:45
【问题描述】:

我有一个包含博客和单页网站的应用程序, 它们都在同一个应用程序中

博客是应用程序的根,而单页网站只是应用程序中的另一个部分。

routs.rb includes

match '/pages' => 'pages#home'
root :to => 'blogs#index'

应用程序托管在 heroku 上并且运行良好:(我通过在 heroku 上托管我的应用程序并将我的 dns 指向 heroku 来实现这一点,即 heroku url 是 fxyear.herokuapp.com,我购买了 fxyear.com 并将其指向 herokuapp .com 并且运行良好。

我想要实现的是我想要一个子域以这样的方式指向 heroku www.summit.fxyear.com 将指向页面,即匹配 '/pages' => 'pages#home' 就是这样,谢谢

【问题讨论】:

    标签: ruby-on-rails heroku dns


    【解决方案1】:

    CNAME

    您的域必须为 change the ANAME or CNAME settings,以便 summit.fxyear.com 子域指向您的 Rails 应用程序(Heroku 应用程序)。

    然后您可以在您的路线中use constraints

    #config/routes.rb
    constraints subdomain: "summit" do 
       get "", to: "pages#home"
    end
    

    【讨论】:

    • 感谢您的回答,效果很好......但添加 (www).summit.fxyear.com 不起作用,但 Summit.fxyear.com 效果很好
    猜你喜欢
    • 2014-11-05
    • 2014-01-31
    • 2011-11-01
    • 2017-08-05
    • 2015-03-31
    • 2017-12-26
    • 2013-06-12
    • 2014-01-02
    • 1970-01-01
    相关资源
    最近更新 更多