Suresh Kumar
Suresh Kumar

Reputation: 1

Redirect one domain web request to other domain web request

I have a requirement to redirect web request to another url in rails.

Lets take my current app is xyz.com. If I hit the xyz.com/mno/dashboard, it has to redirect to abc.com/dashboard.

  1. Reality we don't have mno controller in xyz.com.
  2. when it hits routes it needs to send the request to some controller(just consider like redirect controller)
  3. In that redirection controller I want to handle my redirections to abc.com.

Upvotes: 0

Views: 69

Answers (1)

Jon
Jon

Reputation: 10898

You can just handle this in your routes.rb config:

get '/mno/dashboard', to: redirect('http://example.com/dashboard')

(Note - replace example.com with abc.com. StackOverflow wont allow any other domain if prefixed with http(s)://)

Upvotes: 2

Related Questions