Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Correctly redirect to the website root page (see #8552).
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Nov 15, 2016
1 parent e331658 commit 756a39c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
3 changes: 3 additions & 0 deletions system/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Contao Open Source CMS changelog
Version 3.5.19 (2016-XX-XX)
---------------------------

### Fixed
Correctly redirect to the website root page (see #8552).

### Fixed
Continue rebuilding the search index if there are errors (see #8541).

Expand Down
22 changes: 11 additions & 11 deletions system/modules/core/classes/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,22 +344,22 @@ public static function getRootPageFromUrl()
die_nicely('be_no_root', 'No root page found');
}

// Redirect to the language root (e.g. en/)
if (\Config::get('addLanguageToUrl'))
// Redirect to the website root or language root (e.g. en/)
if (\Environment::get('request') == '')
{
if (!\Config::get('doNotRedirectEmpty') && \Environment::get('request') == '')
if (\Config::get('addLanguageToUrl') && !\Config::get('doNotRedirectEmpty'))
{
static::redirect((!\Config::get('rewriteURL') ? 'index.php/' : '') . $objRootPage->language . '/', 301);
}
}
else
{
$objPage = \PageModel::findFirstPublishedRegularByPid($objRootPage->id);

// Redirect if it is not the language fall back page and the alias is "index" (see #8498)
if ($objPage !== null && (!$objRootPage->fallback || $objPage->alias != 'index'))
else
{
static::redirect($objPage->getFrontendUrl(), 302);
$objPage = \PageModel::findFirstPublishedRegularByPid($objRootPage->id);

// Redirect if it is not the language fall back page and the alias is "index" (see #8498)
if ($objPage !== null && (!$objRootPage->fallback || $objPage->alias != 'index'))
{
static::redirect($objPage->getFrontendUrl(), 302);
}
}
}
}
Expand Down

0 comments on commit 756a39c

Please sign in to comment.