How can I redirect to the home page when I press the browser button back

I have an e-commerce site in which we use the shopping cart page when someone buys a product and pays a payment, and then we thank you for the page,

main page => products => basket => continue payment => thanks

Now, when I click the "Back in browser" button, it goes to the continue payment page and gives session errors.

I want to return to the home page when I click the "Back in browser" button on the thank you page.

Send payment => thanks => home page.

+4
source share
1 answer

On the thank you page, you will set a flag in the session. On previous pages, check this box. If it is installed, send the user to the first page using header('Location: ...'); (remember to run exit; immediately after the title bar).

+1
source

All Articles