Basically every time I use header() to redirect I still carry any hash I had before. And it’s producing bad results in the app, duplicate actions and such.
Trying to erase the hash with JS is no good since I cannot remove the #.
How can I remove it when redirecting?
It must be you who is using
#in yourheader()because PHP does not put#while redirecting…Correct syntax :
header('Location: page.php');If your string is dynamically generated you can use a regex and you can remove
#usingpreg_replace()before it assigns the url toheader()header() Reference