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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Creating a automatic redirector to the parent page


Go to End


873 Views

Avatar
MarioSommereder

Community Member, 107 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-