나는 http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr/srv3에서 마술사는 프록시 서버 뒤에 있습니다 thingspeak 서버를 가지고 있습니다.레일 루트 경로를 변경
어떻게 모든 레일에 "srv3 /"을 추가하도록 레일스에 지시 할 수 있습니까?
/srv3 should be the root.
덕분에이 같은
나는 http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr/srv3에서 마술사는 프록시 서버 뒤에 있습니다 thingspeak 서버를 가지고 있습니다.레일 루트 경로를 변경
어떻게 모든 레일에 "srv3 /"을 추가하도록 레일스에 지시 할 수 있습니까?
/srv3 should be the root.
덕분에이 같은
scope
블록에 모든 경로를 넣어 :
$ rake routes
Prefix Verb URI Pattern Controller#Action
root GET /srv3(.:format) root#index
...
:
Rails.application.routes.draw do
scope "/srv3" do
root to: "root#index"
...
end
end
그런 다음 모든 경로는
/srv3
접두사가됩니다참조 자세한 내용은을 참조하십시오.
나는 많이 당신이 말하는 셈,하지만 내가 이해할 수있는 것은 당신이 당신의 application_controller.rb
에 그럼 다음처럼 작성할 경우 root_path이 http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr/srv3 대신 http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr될 것인지 무엇을 얻을하지 않습니다
before_filter :check_url
def check_url
if request.path_info == '/'
redirect_to 'http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr/srv3'
end
end
또는 너무
def check_url
if request.path_info == '/' and current_user.present?
redirect_to 'http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr/srv3'
end
end
은작동하지 아무튼 인증을 확인하려는 경우 당신은 이런 식으로 뭔가를 할 수 있습니다 routes.rb의내게 : 루트 : to => 'pages # home' "Welcom 타고있다"페이지가 보입니다! –
페이지를 볼 때 URL에''/ srv3''이 있습니까? 나는. 예를 들어 보시겠습니까? 'http :/localhost : 3000/srv3 /'? – BoraMa
예, [http://portail.lyc-st-exupery-bellegarde.ac-lyon.fr/srv3] –