Reputation: 651
I have this simple Rails app I'm working on and for the moment I want to redirect to another server remote URL.
In config/routes.rb I have:
get "/adaptapp" => redirect(path: "https://exturl.com/adaptapp")
And rake routes gives:
Prefix Verb URI Pattern Controller#Action
welcome_index GET /welcome/index(.:format) welcome#index
adaptapp GET /adaptapp(.:format) redirect(301, path:
https://exturl.com/adaptapp)
which to me look OK. But when I try it (http://railsurl.com:3000/adaptapp) I get an error:
No route matches [GET] "/https:/exturl.com/adaptapp"
What's going on? How do I fix this?
Upvotes: 1
Views: 86
Reputation: 899
get "/adaptapp" => redirect("https://exturl.com/adaptapp")
, path
param makes your url relative.
Upvotes: 0
Reputation: 5363
The syntax of a URI is scheme:[//[user[:password]@]host[:port]][/path][?query][#fragment]
Having said, your syntax is yielding the correct response for the code you provided. What you want is redirect("https://exturl.com/adaptapp")
Upvotes: 2