External URL re direction issue IN Rails 2
- by Rcoder
I have a requirement where in I want to redirect to an external Url
Here is my code
in routes.rb
map.connect "/myapp/:someparam" ,
:controller = "foocontroller" ,
:action = "redirect_to_external_url"
In my foo controller i have this action
def redirect_to_external_url
redirect_to "http://externalurl.com/#{params[:someparam]}.html"
end
which will redirect to the external url
The problem That I am facing is
After redirecting, The browser shows "http://externalurl.com/bar.html whereas I want the browser to show "/myapp/bar" url (ex http://mydomain.com/myapp/bar) for seo purpose.
Any idea on how this can be achieved in rails ?
The Rails version that I am using is 2.3.4