diff --git a/core/templates/403.php b/core/templates/403.php index 7d07c72c87..e053fad764 100644 --- a/core/templates/403.php +++ b/core/templates/403.php @@ -1,10 +1,10 @@ printPage(); + + $urlGenerator = \OC::$server->getURLGenerator(); + header('Location: ' . $urlGenerator->getAbsoluteURL('/')); exit; } // @codeCoverageIgnoreEnd diff --git a/core/templates/404.php b/core/templates/404.php index cc45cbeaf5..0f7318e937 100644 --- a/core/templates/404.php +++ b/core/templates/404.php @@ -3,11 +3,11 @@ /** @var $l \OCP\IL10N */ /** @var $theme OCP\Defaults */ // @codeCoverageIgnoreStart -if(!isset($_)) {//also provide standalone error page +if(!isset($_)) {//standalone page is not supported anymore - redirect to / require_once '../../lib/base.php'; - - $tmpl = new OC_Template( '', '404', 'guest' ); - $tmpl->printPage(); + + $urlGenerator = \OC::$server->getURLGenerator(); + header('Location: ' . $urlGenerator->getAbsoluteURL('/')); exit; } // @codeCoverageIgnoreEnd diff --git a/lib/private/Setup.php b/lib/private/Setup.php index f5bfca604a..1e98ed5456 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -449,10 +449,10 @@ class Setup { $htaccessContent = explode($content, $htaccessContent, 2)[0]; //custom 403 error page - $content.= "\nErrorDocument 403 ".$webRoot."/core/templates/403.php"; + $content.= "\nErrorDocument 403 ".$webRoot."/"; //custom 404 error page - $content.= "\nErrorDocument 404 ".$webRoot."/core/templates/404.php"; + $content.= "\nErrorDocument 404 ".$webRoot."/"; // Add rewrite rules if the RewriteBase is configured $rewriteBase = $config->getValue('htaccess.RewriteBase', ''); diff --git a/tests/Core/Templates/TemplatesTest.php b/tests/Core/Templates/TemplatesTest.php deleted file mode 100644 index cd1502fd22..0000000000 --- a/tests/Core/Templates/TemplatesTest.php +++ /dev/null @@ -1,20 +0,0 @@ -
  • \n\t\tAccess forbidden

  • "; - $this->assertTemplate($expectedHtml, $template); - } - - public function test404() { - $template = \OC::$SERVERROOT . '/core/templates/404.php'; - $href = \OC::$server->getURLGenerator()->linkTo('', 'index.php'); - $expectedHtml = ""; - $this->assertTemplate($expectedHtml, $template); - } - -}