It is very strange to see that php header function modifying query string if it is an URL. I used header function like thisheader('Location: http://www.example.com/account-type?goto=http://www.google.com/hello');
This is redirecting to http://www.example.com/account-type?goto=http/hello
modified query string
And if I use relative URL
header('Location: /account-type?goto=http://www.google.com/hello');
this will redirect to http://www.example.com/account-type?goto=http://www.google.com/hello
Can anyone tell me how to fix this issue?
I guess it's just a problem of encoding. Try this:
$url = urlencode('http://www.google.com/hello');
header('Location: http://www.example.com/account-type?goto=' . $url);