External URL re direction issue IN Rails 2
Posted
by
Rcoder
on Stack Overflow
See other posts from Stack Overflow
or by Rcoder
Published on 2011-01-13T08:44:00Z
Indexed on
2011/01/13
8:53 UTC
Read the original article
Hit count: 237
ruby-on-rails
|ruby
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
© Stack Overflow or respective owner