Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Creating a automatic redirector to the parent page


Reply


453 Views

Avatar
theGermaniac

Community Member, 82 Posts

11 September 2013 at 11:49pm

Edited: 11/09/2013 11:50pm

Hej there.

I wrote a redirector page to the parent page inside SiteTree. Works perfectly, but when "Split Mode" is enabled, and I call the page via SiteTree, the CMS jumps to the parent page.

Here ist my code:

class ParentRedirect_Controller extends ContentController
{
   public function init()
   {
      parent::init();
      if($link = $this->Parent()->Link())
      {
         $this->redirect($link, 301);
         return;
      }
   }
}

This issue is not, when using the standard redirector page type. Can anyone tell me, how to avoid this jump to the parent page inside the CMS? Thanks.

-Mario-