Page has expired
Added on: Thursday 29th January 2009
On many websites with search forms, if you do a search and then go to another page to view the results, clicking the back button brings up a 'page has expired' message.
You can of course hit the Refresh button but many people want to go back to the page and have the original search criteria - perhaps you want to view each result in turn.
I've tried various ways in PHP to do this by changing headers etc but the single line of code that works perfectly every time is as follows:
header("Cache-Control: max-age=300, must-revalidate");
The max-age is in seconds so the above keeps the page 'alive' for 5 minutes. You can change this as you like.