Welcome Guest, Not a member yet? Register   Sign In
Redirecting does not remove anchor from the URL
#1
Bug 
(This post was last modified: 04-19-2023, 04:45 AM by Muzikant.)

If an anchor is in the old page, it is still presented after redirecting to the new page, where it does not make sense. An anchor should not be there until it is explicitly added in the redirection rule.



For example return redirect()->to('to'); redirecting http://localhost:8080/from#old-anchor to http://localhost:8080/to#old-anchor, which it should not.

The return redirect()->to('to#new-anchor'); redirecting http://localhost:8080/from to http://localhost:8080/to#new-anchor, which is how it should be.

It is also replacing an old anchor to a new anchor, which is also expected: return redirect()->to('to#new-anchor'); redirecting http://localhost:8080/from#old-anchor to http://localhost:8080/to#new-anchor.

So the only problem is in the first case, when old URL have an anchor, but the new URL does not. The same with the redirectResponse.



return redirect()->route('to'); and return redirect('to'); does not support anchors in the redirection rule, but the bug from the first example is presented. I tested it on a fresh CodeIgniter's 4.3.3 installation on PHP 8.1.12 on my Linux machine.
Reply


Messages In This Thread
Redirecting does not remove anchor from the URL - by Muzikant - 04-19-2023, 03:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB