ruby on rails - how to put an URL as a parameter in another URL for successful parsing -
say want set url: www.a.com?str1=12&str2=67
parameter in url can parsed properly.
problem: set parameter in url as-
www.a.com?redirect_to=www.a.com?str1=12&str2=67
then happens when parse url value of redirect_to
www.a.com?str1=12
because strt2
considered parameter. can www.a.com?str1=12&str2=67
value of redirect_to
?
try escaping redirect url cgi.escape:
require 'cgi' my_url = "www.a.com?redirect_to=#{cgi.escape('www.a.com?str1=12&str2=67')}" # my_url => "www.a.com?redirect_to=www.a.com%3fstr1%3d12%26str2%3d67"
Comments
Post a Comment