*/
public $forceCanonicalURL = false;
+ /**
+ * is true if the redirect should use a 307 instead of the default 301, not recommended in general
+ * @var boolean
+ */
+ public $softRedirectCanonicalURL = false;
+
/**
* indicates if you need to be logged in to access this page
* @var boolean
// force a permanent redirect as recommended by Google
// https://support.google.com/webmasters/answer/6033086?hl=en#a_note_about_redirects
- HeaderUtil::redirect($redirectURL, true, false);
+ HeaderUtil::redirect($redirectURL, true, $this->softRedirectCanonicalURL);
exit;
}
}
}
$this->canonicalURL = LinkHandler::getInstance()->getCmsLink($this->pageID, $this->languageID);
+ if ($this->page->isMultilingual && RequestHandler::getInstance()->getActiveRequest()->getMetaData()['isDefaultController']) {
+ if ($this->languageID != LanguageFactory::getInstance()->getDefaultLanguageID()) {
+ $this->softRedirectCanonicalURL = true;
+ }
+ }
// update interface language
if (!WCF::getUser()->userID && $this->page->isMultilingual && $this->languageID != WCF::getLanguage()->languageID) {
}
// handle CMS page meta data
- $metaData = [];
+ $metaData = ['isDefaultController' => (!empty($routeData['isDefaultController']))];
if (isset($routeData['cmsPageID'])) {
$metaData['cms'] = [
'pageID' => $routeData['cmsPageID'],
foreach ($data as $key => $value) {
$routeData[$key] = $value;
}
+
+ $routeData['isDefaultController'] = true;
}
/**