So I have been trying to create a controller action that does a redirect to another route, for example:
public function index() { response()->redirect('/products'); }
This doesn't work, it stays on the same page. Although, if I use the php header() function instead, it works
I have debugged a bit and found that:
When Headers:set() gets called in Response::redirect(), we don't pass the status code, so it will use the default code 200 and wont do the redirect, since it needs the code 302 for that
So I have been trying to create a controller action that does a redirect to another route, for example:
public function index() { response()->redirect('/products'); }
This doesn't work, it stays on the same page. Although, if I use the php
header()
function instead, it worksI have debugged a bit and found that: When
Headers:set()
gets called inResponse::redirect()
, we don't pass the status code, so it will use the default code200
and wont do the redirect, since it needs the code302
for thatWould be great if you guys could have a look
Thank you in advance