From 56dca7bcd3ba8da5eca6e085ced9f79238a92438 Mon Sep 17 00:00:00 2001 From: Markus Klein <markus.klein@typo3.org> Date: Thu, 10 Nov 2016 18:22:56 +0100 Subject: [PATCH] [TASK] Remove typo3/.htaccess 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 | 24 ------------------------ typo3/install/index.php | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 24 deletions(-) delete mode 100644 typo3/.htaccess create mode 100644 typo3/install/index.php diff --git a/typo3/.htaccess b/typo3/.htaccess deleted file mode 100644 index 857a9d45ca3c..000000000000 --- a/typo3/.htaccess +++ /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 index 000000000000..e0817d8c91fb --- /dev/null +++ b/typo3/install/index.php @@ -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); +}); -- GitLab