Commit 558b6a6f authored by Tino Goratsch's avatar Tino Goratsch

force the canonical URLs to be absolute URLs

parent 82ccf75c
Pipeline #17293432 passed with stages
in 11 minutes and 30 seconds
......@@ -47,9 +47,7 @@ abstract class AbstractRequest implements RequestInterface
}
/**
* Returns the used protocol of the current request.
*
* @return string
* {@inheritdoc}
*/
public function getScheme()
{
......@@ -57,9 +55,7 @@ abstract class AbstractRequest implements RequestInterface
}
/**
* Returns the hostname of the current request.
*
* @return string
* {@inheritdoc}
*/
public function getHost()
{
......@@ -67,9 +63,7 @@ abstract class AbstractRequest implements RequestInterface
}
/**
* Returns the protocol with the hostname.
*
* @return string
* {@inheritdoc}
*/
public function getHttpHost()
{
......@@ -77,7 +71,7 @@ abstract class AbstractRequest implements RequestInterface
}
/**
* @return bool
* {@inheritdoc}
*/
public function isXmlHttpRequest()
{
......@@ -85,9 +79,7 @@ abstract class AbstractRequest implements RequestInterface
}
/**
* Returns the parameter bag of the $_COOKIE superglobal.
*
* @return \Symfony\Component\HttpFoundation\ParameterBag
* {@inheritdoc}
*/
public function getCookies()
{
......@@ -95,9 +87,7 @@ abstract class AbstractRequest implements RequestInterface
}
/**
* Returns the parameter bag of the uploaded files ($_FILES superglobal).
*
* @return \Symfony\Component\HttpFoundation\FileBag
* {@inheritdoc}
*/
public function getFiles()
{
......@@ -105,9 +95,7 @@ abstract class AbstractRequest implements RequestInterface
}
/**
* Returns the parameter bag of the $_POST superglobal.
*
* @return \Symfony\Component\HttpFoundation\ParameterBag
* {@inheritdoc}
*/
public function getPost()
{
......@@ -115,9 +103,7 @@ abstract class AbstractRequest implements RequestInterface
}
/**
* Returns the parameter bag of the $_SERVER superglobal.
*
* @return \Symfony\Component\HttpFoundation\ServerBag
* {@inheritdoc}
*/
public function getServer()
{
......@@ -125,7 +111,7 @@ abstract class AbstractRequest implements RequestInterface
}
/**
* @return \ACP3\Core\Http\Request\UserAgent
* {@inheritdoc}
*/
public function getUserAgent()
{
......@@ -133,9 +119,7 @@ abstract class AbstractRequest implements RequestInterface
}
/**
* @param string $homepage
*
* @return $this
* {@inheritdoc}
*/
public function setHomepage($homepage)
{
......
......@@ -31,7 +31,9 @@ interface RequestInterface
public function getHost();
/**
* Returns the protocol with the hostname.
* Returns the HTTP host being requested.
*
* The port name will be appended to the host if it's non-standard.
*
* @return string
*/
......
......@@ -175,7 +175,7 @@ class Index extends AbstractAction
{
if ($cat !== 0 && $this->newsSettings['category_in_breadcrumb'] == 1) {
if ($this->metaStatements instanceof MetaStatements) {
$this->metaStatements->setCanonicalUri($this->router->route('news'));
$this->metaStatements->setCanonicalUri($this->router->route('news', true));
}
$this->breadcrumb->append($this->translator->t('news', 'news'), 'news');
......
......@@ -77,7 +77,7 @@ class Pagination extends \ACP3\Core\Pagination
{
$path = ($this->request->getArea() === AreaEnum::AREA_ADMIN ? 'acp/' : '') . $this->request->getUriWithoutPages();
return $this->router->route($path);
return $this->router->route($path, true);
}
/**
......
......@@ -78,7 +78,7 @@ class OnControllerActionBeforeDispatchListener
private function setCanonicalForExistingUriAlias(ControllerActionBeforeDispatchEvent $event)
{
if ($this->isInFrontend($event) && $this->uriAliasExists()) {
$this->metaStatements->setCanonicalUri($this->router->route($this->request->getQuery()));
$this->metaStatements->setCanonicalUri($this->router->route($this->request->getQuery(), true));
}
}
......@@ -108,7 +108,7 @@ class OnControllerActionBeforeDispatchListener
private function setCanonicalForHomepage()
{
if ($this->request->isHomepage()) {
$this->metaStatements->setCanonicalUri($this->applicationPath->getWebRoot());
$this->metaStatements->setCanonicalUri($this->request->getSymfonyRequest()->getSchemeAndHttpHost() . $this->applicationPath->getWebRoot());
}
}
}
......@@ -4,7 +4,6 @@
* Copyright (c) by the ACP3 Developers.
* See the LICENSE file at the top-level module directory for licensing details.
*/
\define('ACP3_ROOT_DIR', \realpath(__DIR__) . '/');
require ACP3_ROOT_DIR . 'vendor/autoload.php';
......
......@@ -4,7 +4,6 @@
* Copyright (c) by the ACP3 Developers.
* See the LICENSE file at the top-level module directory for licensing details.
*/
\define('ACP3_ROOT_DIR', \realpath(__DIR__ . '/../') . '/');
require ACP3_ROOT_DIR . 'vendor/autoload.php';
......
......@@ -4,7 +4,6 @@
* Copyright (c) by the ACP3 Developers.
* See the LICENSE file at the top-level module directory for licensing details.
*/
\define('ACP3_ROOT_DIR', \realpath(__DIR__ . '/../') . '/');
require ACP3_ROOT_DIR . 'vendor/autoload.php';
......
......@@ -4,7 +4,6 @@
* Copyright (c) by the ACP3 Developers.
* See the LICENSE file at the top-level module directory for licensing details.
*/
require_once __DIR__ . '/../vendor/autoload.php';
\define('ACP3_ROOT_DIR', \realpath(__DIR__ . '/../') . '/');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment