core-bundle/src/Resources/contao/pages/PageRoot.php
public function generate($rootPageId, $blnReturn=false, $blnPreferAlias=false)
	{
		if (!$blnReturn)
		{
			$this->redirect($this->getRedirectUrl($rootPageId), 302);
		}

		$objNextPage = $this->getNextPage($rootPageId);

		return ($blnPreferAlias && $objNextPage->alias != '') ? $objNextPage->alias : $objNextPage->id;
	}
public function generate($rootPageId, $blnReturn=false, $blnPreferAlias=false)
	{
		if (!$blnReturn)
		{
			$this->redirect($this->getRedirectUrl($rootPageId), 302);
		}

		$objNextPage = $this->getNextPage($rootPageId);

		return ($blnPreferAlias && $objNextPage->alias != '') ? $objNextPage->alias : $objNextPage->id;
	}
Redirect to the first active regular page

@param integer $rootPageId
@param boolean $blnReturn
@param boolean $blnPreferAlias

@return integer