Browser back buttion url modification

Can anyone suggest a solution for this.

I have a search page in my site like http://mysite.com/search.php. I am displaying the search results in this page only.
When i click on a search result item, it will redirect to a page and it will do some process and redirect to another page.

Now, i want to goback to the search results page from the third page when clicking on the browser back button from third page.

is it possible to modify the browser back button behaviour?

It is possible when using the appropriate redirect technique, a 302 is most common.

For example, this from the PHP header page will do a 302 redirect:


<?php
header("Location: http://www.example.com/"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>

This prevents the page you’re redirecting from, from appearing in the back button