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