I am trying to do a redirect with query parameters, using the redirect()
helper:
$link = 'https://example.com' . '?key1=value1&key2=value2';
return redirect()->to($link);
The problem is that when the $link
is passed to the to()
method Laravel removes the question mark leading the query string, so it turns this:
https://example.com?key1=value1&key2=value2
into this:
https://example.comkey1=value1&key2=value2
(again, notice the missing ?
in the final link).
How do I make a redirect with query params appended to a custom URL?