重定向到新网址,但从历史记录中删除以前的网址

How to replaces the current URL document with a new one but removes the URL of the current document from the document history, meaning that it is not possible to use the "back" button to navigate back to the original document and not store in browser history list.

I can to this by jQuery or javascript by

  window.location.replace("newURL");

but I need to do like this in php.HOW?

If you want no remnants of the page in the browser history at all, then you cannot send the browser there because it will keep track of all visited pages in the history so it can properly show which links have been visited. As best as I know, there is no way to stop the browser from keeping track of the visited links. If you do a 302 location redirect from the server, both original and redirected page will be in the browser history. The original page will not be in the back-button list, but will be in the history.

If the part of the URL that you are trying to keep less visible is query parameters to the URL, then you can use a form post instead of regular page load because the browser will not store form parameters in the visible part of the history.

Otherwise, you may need to use your URL with an Ajax call (since that will not be stored in the history) and then use client-side window.location.replace(...) to go to the final URL, the idea being that the URL you don't want to share publicly will have never been an URL that the browser page went to, only a URL that was used for an Ajax call.

If you do a <?php header('Location: http://www.abc.de/'); ?> on the page http://www.something.de/ then the page http://www.something.de/ will not be visible in the browsing history nor can the user navigate back. Is this what you are asking for?

If you want to clear your previous page, try to use "history.back();" and then set your windows.location.