Skip to content
Snippets Groups Projects
Commit 8c225c61 authored by Christian Kuhn's avatar Christian Kuhn Committed by Anja Leichsenring
Browse files

[TASK] Create .htaccess or web.config file upon installation

With the new routing, TYPO3 relies on a default redirect to index.php
for FE requests. The patch checks during installation if apache or IIS
are used and creates the default .htaccess / web.config files.

Change-Id: I9406a7e4d91050d3f5bf96dd63e4bf63e8f71250
Resolves: #86173
Releases: master
Reviewed-on: https://review.typo3.org/58451


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Reviewed-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent d59b0c81
Branches
Tags
No related merge requests found
......@@ -39,12 +39,12 @@ class DefaultFactory
*
* @return array
*/
protected function getDefaultStructureDefinition()
protected function getDefaultStructureDefinition(): array
{
$filePermission = $GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'];
$directoryPermission = $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'];
return [
$structure = [
// Note that root node has no trailing slash like all others
'name' => Environment::getPublicPath(),
'targetPermission' => $directoryPermission,
......@@ -212,5 +212,24 @@ class DefaultFactory
],
],
];
// Have a default .htaccess if running apache web server or a default web.config if running IIS
if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === 0) {
$structure['children'][] = [
'name' => '.htaccess',
'type' => FileNode::class,
'targetPermission' => $filePermission,
'targetContentFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-htaccess',
];
} elseif (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') === 0) {
$structure['children'][] = [
'name' => 'web.config',
'type' => FileNode::class,
'targetPermission' => $filePermission,
'targetContentFile' => Environment::getPublicPath() . '/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-web-config',
];
}
return $structure;
}
}
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