Allow to use new TYPO3 backend routing
This prevents deprecation trigger due to using old legacy routing.
This commit is contained in:
parent
496f3687b3
commit
68b07171a6
|
@ -11,6 +11,7 @@
|
||||||
relativeDocumentRoot = "own/daniel-siepmann/project/public/";
|
relativeDocumentRoot = "own/daniel-siepmann/project/public/";
|
||||||
databaseName = "own_danielsiepmann";
|
databaseName = "own_danielsiepmann";
|
||||||
phpPackage = pkgs.php83;
|
phpPackage = pkgs.php83;
|
||||||
|
httpdRewriteTypo3Backend = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,18 @@ let
|
||||||
|
|
||||||
cfg = config.custom.web-development.typo3;
|
cfg = config.custom.web-development.typo3;
|
||||||
|
|
||||||
|
legacyRewriteRule = ''
|
||||||
|
# If the file/symlink/directory does not exist but is below /typo3/, redirect to the TYPO3 Backend entry point.
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-l
|
||||||
|
RewriteCond %{REQUEST_URI} ^/typo3/.*$
|
||||||
|
RewriteRule ^typo3/(.*)$ %{ENV:CWD}typo3/index.php [QSA,L]
|
||||||
|
'';
|
||||||
|
currentRewriteRule = ''
|
||||||
|
|
||||||
|
'';
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.custom.web-development.typo3 = lib.mkOption {
|
options.custom.web-development.typo3 = lib.mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
|
@ -49,6 +61,14 @@ in {
|
||||||
Provide any extra environment variables to be exposed to PHP-FPM.
|
Provide any extra environment variables to be exposed to PHP-FPM.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
httpdRewriteTypo3Backend = lib.mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Define whether to rewrite TYPO3 backend routing to /typo3/index.php.
|
||||||
|
Needed for installations prior TYPO3 v13.2.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -110,56 +130,61 @@ in {
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
<Directory ${documentRoot}>
|
<Directory ${documentRoot}>
|
||||||
AllowOverride None
|
AllowOverride None
|
||||||
Require all granted
|
Require all granted
|
||||||
DirectoryIndex index.php
|
DirectoryIndex index.php
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
|
||||||
# Store the current location in an environment variable CWD to use
|
# Store the current location in an environment variable CWD to use
|
||||||
# mod_rewrite in .htaccess files without knowing the RewriteBase
|
# mod_rewrite in .htaccess files without knowing the RewriteBase
|
||||||
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
|
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
|
||||||
RewriteRule ^.*$ - [E=CWD:%2]
|
RewriteRule ^.*$ - [E=CWD:%2]
|
||||||
|
|
||||||
# Rule for versioned static files, configured through:
|
# Rule for versioned static files, configured through:
|
||||||
# - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
|
# - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
|
||||||
# - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
|
# - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
|
||||||
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
|
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ %{ENV:CWD}$1.$3 [L]
|
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ %{ENV:CWD}$1.$3 [L]
|
||||||
|
|
||||||
# Access block for folders
|
# Access block for folders
|
||||||
RewriteRule _(?:recycler|temp)_/ - [F]
|
RewriteRule _(?:recycler|temp)_/ - [F]
|
||||||
RewriteRule fileadmin/templates/.*\.(?:txt|ts)$ - [F]
|
RewriteRule fileadmin/templates/.*\.(?:txt|ts)$ - [F]
|
||||||
RewriteRule ^(?:vendor|typo3_src|typo3temp/var) - [F]
|
RewriteRule ^(?:vendor|typo3_src|typo3temp/var) - [F]
|
||||||
RewriteRule (?:typo3conf/ext|typo3/sysext|typo3/ext)/[^/]+/(?:Configuration|Resources/Private|Tests?|Documentation|docs?)/ - [F]
|
RewriteRule (?:typo3conf/ext|typo3/sysext|typo3/ext)/[^/]+/(?:Configuration|Resources/Private|Tests?|Documentation|docs?)/ - [F]
|
||||||
|
|
||||||
# Block access to all hidden files and directories with the exception of
|
# Block access to all hidden files and directories with the exception of
|
||||||
# the visible content from within the `/.well-known/` hidden directory (RFC 5785).
|
# the visible content from within the `/.well-known/` hidden directory (RFC 5785).
|
||||||
RewriteCond %{REQUEST_URI} "!(^|/)\.well-known/([^./]+./?)+$" [NC]
|
RewriteCond %{REQUEST_URI} "!(^|/)\.well-known/([^./]+./?)+$" [NC]
|
||||||
RewriteCond %{SCRIPT_FILENAME} -d [OR]
|
RewriteCond %{SCRIPT_FILENAME} -d [OR]
|
||||||
RewriteCond %{SCRIPT_FILENAME} -f
|
RewriteCond %{SCRIPT_FILENAME} -f
|
||||||
RewriteRule (?:^|/)\. - [F]
|
RewriteRule (?:^|/)\. - [F]
|
||||||
|
|
||||||
# Stop rewrite processing, if we are in any other known directory
|
# Stop rewrite processing, if we are in any other known directory
|
||||||
# NOTE: Add your additional local storages here
|
# NOTE: Add your additional local storages here
|
||||||
RewriteRule ^(?:fileadmin/|typo3conf/|typo3temp/|uploads/) - [L]
|
RewriteRule ^(?:fileadmin/|typo3conf/|typo3temp/|uploads/) - [L]
|
||||||
|
|
||||||
# If the file/symlink/directory does not exist but is below /typo3/, redirect to the TYPO3 Backend entry point.
|
# If the file/symlink/directory does not exist but is below /typo3/, redirect to the main TYPO3 entry point.
|
||||||
|
'' + (if cfg.httpdRewriteTypo3Backend then ''
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteCond %{REQUEST_FILENAME} !-l
|
RewriteCond %{REQUEST_FILENAME} !-l
|
||||||
RewriteCond %{REQUEST_URI} ^/typo3/.*$
|
RewriteCond %{REQUEST_URI} ^/typo3/.*$
|
||||||
RewriteRule ^typo3/(.*)$ %{ENV:CWD}typo3/index.php [QSA,L]
|
RewriteRule ^typo3/(.*)$ %{ENV:CWD}typo3/index.php [QSA,L]
|
||||||
|
'' else ''
|
||||||
# If the file/symlink/directory does not exist => Redirect to index.php.
|
|
||||||
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteRule ^typo3/(.*)$ %{ENV:CWD}index.php [QSA,L]
|
||||||
RewriteCond %{REQUEST_FILENAME} !-l
|
'') + ''
|
||||||
RewriteRule ^.*$ %{ENV:CWD}index.php [QSA,L]
|
|
||||||
</Directory>
|
# If the file/symlink/directory does not exist => Redirect to index.php.
|
||||||
|
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-l
|
||||||
|
RewriteRule ^.*$ %{ENV:CWD}index.php [QSA,L]
|
||||||
|
</Directory>
|
||||||
|
|
||||||
<FilesMatch "\.php$">
|
<FilesMatch "\.php$">
|
||||||
SetHandler "proxy:unix:${config.services.phpfpm.pools."${domainName}".socket}|fcgi://${domainName}/"
|
SetHandler "proxy:unix:${config.services.phpfpm.pools."${domainName}".socket}|fcgi://${domainName}/"
|
||||||
|
|
Loading…
Reference in a new issue