I thkink this is a easy question, but I didn't find the solution. In Rails, How can I get my application URL inside routes?
Something like:
get '/foo', to: redirect("http://whatheverurl.com/?bar=#{MY_APPLICATION_URL}")
match '/foo', :to => redirect { |params, request|
"http://whatheverurl.com/?bar=#{request.env['HTTP_HOST']}"
}
You could do something like this:
match "/web_site", :to => proc { |env|
[301, {
'Location' => "http://www.greenviewdata.com?from=#{env['HTTP_HOST']}"
}, ["Go here instead: http://www.greenviewdata.com?from=#{env['HTTP_HOST']}"]]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.