Good afternoon! The question arose. I'm using PHP. User goes to example.com/in/ and the script redirects to http://example.com/ (using header("Location: ...") ;). How to avoid saving example.com/in/ in the browser history?
I was fighting the same problem as you and this is what I found:
PHP:
There is no such function in php, there is a way to replace a previous similar header in php though, but I don't think that this is what you are looking for! (php manual)
Javascript:
There are several functions and ways to directly or indirectly manipulate the browser history:
window.location.replace("http://...")
to redirect a user without saving the current page to the browser historywindow.history.back()
to redirect the user one page back in the browser history (acts exactly like the back button of the browser)window.history.forward()
same as window.history.back() but forwardwindow.history.go(index)
loads a specific page from session history, using its relative position in session history as an index (the current page has the index 0)history.replaceState()
and history.pushState()
read thisTo answer your question:
Depending on what you are doing you can use one of these js-methods. Unfortunately, as mentioned, there is no such thing in PHP if I'm not mistaken.