diff --git a/core/templates/403.php b/core/templates/403.php
index 7d07c72c873a4e6be22c3c6d89c2de38eb0de5e0..e053fad764a5fabd981aa2970a7b57ce84cebe4f 100644
--- a/core/templates/403.php
+++ b/core/templates/403.php
@@ -1,10 +1,10 @@
 <?php
 // @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( '', '403', 'guest' );
-	$tmpl->printPage();
+
+	$urlGenerator = \OC::$server->getURLGenerator();
+	header('Location: ' . $urlGenerator->getAbsoluteURL('/'));
 	exit;
 }
 // @codeCoverageIgnoreEnd
diff --git a/core/templates/404.php b/core/templates/404.php
index cc45cbeaf5dd743cd8e90f85f7ff0134c021aa56..0f7318e937ae9c1e0552fdf086d47ec465c92cb3 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 f5bfca604a981fb06518b943ddf4b98aa2366f48..1e98ed5456dc60121ff25768eb08d7f43667095f 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 cd1502fd22cbf3e3a4f97beb43e4b649ced542c7..0000000000000000000000000000000000000000
--- a/tests/Core/Templates/TemplatesTest.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-namespace Tests\Core\Templates;
-
-class TemplatesTest extends \Test\TestCase {
-
-	public function test403() {
-		$template = \OC::$SERVERROOT . '/core/templates/403.php';
-		$expectedHtml = "<ul><li class='error'>\n\t\tAccess forbidden<br><p class='hint'></p></li></ul>";
-		$this->assertTemplate($expectedHtml, $template);
-	}
-
-	public function test404() {
-		$template = \OC::$SERVERROOT . '/core/templates/404.php';
-		$href = \OC::$server->getURLGenerator()->linkTo('', 'index.php');
-		$expectedHtml = "<ul><li class='error'>\n\t\t\tFile not found<br><p class='hint'>The specified document has not been found on the server.</p>\n<p class='hint'><a href='$href'>You can click here to return to Nextcloud.</a></p>\n\t\t</li></ul>";
-		$this->assertTemplate($expectedHtml, $template);
-	}
-
-}