I've noticed on many websites this very useful characteristic:
Say you log in, or sign up. After clicking the submit form button, you're directed to a page in the website (that's inaccessible to non-members). But when you click the back button, instead of going back to the forms, you're redirected to the homepage.
Could anyone please explain how I can achieve this?

Thank you for your time.