Redirect to route without get params with Laravel
<p>I have some legacy urls with get params that I want to redirect to the route without these get parameters.</p>

<p>In my web.php I have:</p>

<pre><code>Route::get('/', ['as' =&gt; 'welcome', 'uses' =&gt; 'PageController@welcome']);
</code></pre>

<p>URLs like <a href="http://example.com/?page_id=5" rel="nofollow noreferrer">http://example.com/?page_id=5</a> should redirect (302) to <a href="http://example.com/" rel="nofollow noreferrer">http://example.com/</a>.</p>

<p>In the controller I tried the following:</p>

<pre><code>public function welcome(Request $request)
{
    if($request-&gt;has('page_id')) {

        redirect()-&gt;to('welcome', 302);
    }

    return view('welcome');
}
</code></pre>

<p>It reaches the redirect but the the url still has the ?page_id=5 in it. Something like: </p>

<pre><code>redirect()-&gt;to('welcome', 302)-&gt;with('page_id', null);
</code></pre>

<p>Made no difference as well. What is the best way in Laravel 5.3 to redirect a page with parameters after the ? to one without parameters?</p>