Jump to:

23483 Posts in 18965 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Creating a automatic redirector to the parent page

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

Page: 1
Go to End
Author Topic: 425 Views
  • theGermaniac
    Avatar
    Community Member
    82 Posts

    Creating a automatic redirector to the parent page Link to this post

    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-

    425 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.