I have a search box on my site, whereby the user enters a term and results are displayed. When they click one of the results (a product) they get taken to the product page. When they then hit the back button, they get shown a "Warning: this page has expired" message.
I am using CakePHP on Apache, and have been advised that I need to change session.cache_control? I have tried chaning it to private in htaccess, but it does not seem to have helped.
Any help much appreciated.
Cheers, D
This is nothing to do with CakePHP nor sessions. Indeed, the issue arises in all web programming languages.
The solution is to make the search results page cacheable - I would imagine that you're not updating your catalog every 5 minutes?
To make it cacheable you need to ensure that the search terms are sent using a GET rather than a POST, then set the right headers to enable the browser to cache the page, e.g.
header('Cache-Control: max-age=360'); // allows browser to keep for 1 hour
....and if you're using sessions which may constrict the visiblity of certain products in the search:
header('Varies: Cookie');
C.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With