We need to show a page in case users come from a specific URL therefore we can achieve it with the following:

$refererSite = Mage::helper('core/http')->getHttpReferer();

however if user is not active for 30 minuets, the page should automatically be redirected to homepage.

We can create a session for the user by


and give some time to it

$myValue = time();

I know the PHP way that is


but is that what I should do?

Now one question is do I need to create a session at all or whoever comes already has a session and I need to set a time limit for it? if yes how to set a time limit and use it for refresh?

I am not sure how to tell that if session is not active for 30 minuets then redirect them to the homepage.

based on my experience even if you are not active, nothing will happen to the frontend webpage, Then I have to do something to force the page to refresh again.


"The PHP-way" is NOT what you should do. You don't need to create a new session.

I leave out code for custom module and post just the relevant part. (if required let me know)

Add an observer for your cms page, that should redirect ...


<?xml version="1.0" encoding="UTF-8"?>
            <!-- adjust full action name cms_index_index to your needs -->


public function test(Varien_Event_Observer $observer)
    // check referer url code
    $refererSite = Mage::helper('core/http')->getHttpReferer();
    if ($refererSite === 'your_referer_url') {
        $observer = $observer->getEvent()
            ->setHeader('refresh', '1800; url=homepagexxx.php');
  • I did not try it. – Nickool Jul 24 '17 at 19:53
  • @Nickool what was the bounty for if you've not tried? Spent several ages to find a something working :P – sv3n Aug 7 '17 at 21:50
  • we did it with javascript finally.I don't know lol we were looking for it a lot. – Nickool Aug 14 '17 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.