Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

KLM113's avatar
Level 2

Reloading the page after a redirection brings the previous route

    Route::post('/store',  [MyController::class, 'store']);

	public function store()
	{
        ...
		
        return redirect('/show');
	}

So if I refresh the page after /show is loaded the browser attempts to launch a request to /store instead of /show. Why is that and how can I fix it?

0 likes
2 replies
jjoek's avatar
jjoek
Best Answer
Level 10

@klm113 This has something to do with browser caching and your redirect. The above redirect('/show') issues out a 302 temporary redirect request.

To fix the above, specifically specify where by using the redirect()->to('/show') which should issue out a 303 response informing the browser that it is done with the post request and can now proceed to the /show route.

checkout this video here for more: Prevent duplicate form submissions using the Post / Redirect / Get pattern

1 like

Please or to participate in this conversation.