开发者

How can we get multi_site extension for Radiant working on Heroku?

开发者 https://www.devze.com 2022-12-12 10:57 出处:网络
Has anyone got RadiantCMS with multi_site working on Heroku? I actually tried it and it bombed big-time giving the error:

Has anyone got RadiantCMS with multi_site working on Heroku? I actually tried it and it bombed big-time giving the error:

Heroku | No such app
There is no app configured at that hostname.
Perhaps the app owner has renamed it, or you mistyped the URL.

This is what I tried:

  1. Go to tractor.heroku.com and login using admin / radiant.
  2. If you see the 'Sites' sect开发者_运维技巧ion, you will find Foo and Bar sites.
  3. I edited my /etc/hosts files and added foo.myapp.com and bar.myapp.com to the IP address that resolves to tractor.heroku.com (Not entirely sure if this is right)
  4. Now type the URL "http://foo.myapp.com" in the browser and it gives me the above error.

Is there some special configuration required to get this working on Heroku?


So, I finally did get an answer from heroku support themselves. Pasting it here for everyone's benefit:

reception said: fyi if you want a 301 redirect from appname.heroku.com url to yourdomain.tld i succeeded with this steps:

  1. freeze radiant (in order to be able to modify application_controller.rb; see http://wiki.github.com/radiant/radiant/running-on-edge )

  2. add this code to application_controller.rb inside class ApplicationController:

---->8

before_filter :redirect_domain
def redirect_domain
  if request.host == 'appname.heroku.com'
    redirect_to "http://yourdomain.tld#{request.request_uri}", :status=>301
  end
end

---->8

(big thanx to David from suppport!)

regards D

0

精彩评论

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