0

I am developing an impresspages plugin where I need a redirection. For such a thing I catch the event ipInitFinished, v.g., creating a code like this:

class Event {
public static function ipInitFinished()
{
    if( !(ipIsManagementState()))
    {
       $site = ipHomeUrl();
       $page = ipGetOption('SiteMaintenance.messagePage');
       header('location: ' . $site.$page);
       exit;
    }
}

messagePage is a field of the plugin that store the page name to display on redirection. This page is a normal page created in impresspages environment.

However, when the plugin routine is executed the browser raise an error related to looping or recursive redirect.

How to solve this?

1 Answers1

0

The problem is, that when $site.$page is loading, the same code will be executed again causing a redirect loop. You have to check if the current page is not equal to $site.$page.

Mangirdas Skripka
  • 1,647
  • 1
  • 15
  • 14