[TASK] Remove typo3/.htaccess 81/50581/6
authorMarkus Klein <markus.klein@typo3.org>
Thu, 10 Nov 2016 17:22:56 +0000 (18:22 +0100)
committerAlexander Opitz <opitz.alexander@googlemail.com>
Fri, 11 Nov 2016 14:18:48 +0000 (15:18 +0100)
The current solution caused a lot of troubles with server configuration.
To avoid any nasty workarounds we simply create a real entry point again.

Resolves: #78645
Releases: master, 7.6
Change-Id: I9003ffe8308290a145fe36a1e9ff884016ea0523
Reviewed-on: https://review.typo3.org/50581
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Kiessling <andreas.kiessling@web.de>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
typo3/.htaccess [deleted file]
typo3/install/index.php [new file with mode: 0644]

diff --git a/typo3/.htaccess b/typo3/.htaccess
deleted file mode 100644 (file)
index 857a9d4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<IfModule mod_rewrite.c>
-
-       RewriteEngine On
-       # Use options from the htaccess in the main directory of the frontend in order
-       # to have versioned static files and TYPO3_CONTEXT working
-       RewriteOptions inherit
-
-       # Store the current location in an environment variable CWD to use
-       # mod_rewrite in .htaccess files without knowing the RewriteBase
-       RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
-       RewriteRule ^.*$ - [E=CWD:%2]
-
-       # Block non-existing .map files, which are requested by some browsers.
-       # We need to do that this way here, because otherwise the rewrite logic
-       # of the parent folder will redirect such a request to the typo3/index.php
-       # causing the BE (login) to be returned.
-       # This is due to the nature of 'RewriteOptions inherit', which copies the rules
-       # virtually into this file (at the end) and then the defined rules, which include
-       # 'typo3/' will not match in the context of this file.
-       RewriteRule \.map$ - [F]
-
-       # Redirect install tool files
-       RewriteRule ^install(\/?.*)$ %{ENV:CWD}sysext/install/Start/Install.php [R=307,L]
-</IfModule>
diff --git a/typo3/install/index.php b/typo3/install/index.php
new file mode 100644 (file)
index 0000000..e0817d8
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+// This is a stub file for redirecting the user to the proper Install Tool URL
+
+call_user_func(function () {
+
+    // We leverage the class loader here to get the static functionality of GeneralUtility and HttpUtility.
+    // This way we do not need to copy all the code here to cope with correct location header URL generation correctly
+    // as those two classes can already correctly deal with all known edge cases.
+
+    require __DIR__ . '/../../vendor/autoload.php';
+
+    // We ensure that possible notices from Core code do not kill our redirect due to PHP output
+    error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED));
+
+    \TYPO3\CMS\Core\Utility\HttpUtility::redirect('../sysext/install/Start/Install.php', \TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_307);
+});