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
c71f9261cd
|
@ -11,6 +11,7 @@
|
|||
relativeDocumentRoot = "own/daniel-siepmann/project/public/";
|
||||
databaseName = "own_danielsiepmann";
|
||||
phpPackage = pkgs.php83;
|
||||
httpdRewriteTypo3Backend = false;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -49,6 +49,14 @@ in {
|
|||
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 +118,61 @@ in {
|
|||
|
||||
extraConfig = ''
|
||||
<Directory ${documentRoot}>
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
DirectoryIndex index.php
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
DirectoryIndex index.php
|
||||
|
||||
RewriteEngine On
|
||||
RewriteEngine On
|
||||
|
||||
# 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]
|
||||
# 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]
|
||||
|
||||
# Rule for versioned static files, configured through:
|
||||
# - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
|
||||
# - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
|
||||
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ %{ENV:CWD}$1.$3 [L]
|
||||
# Rule for versioned static files, configured through:
|
||||
# - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
|
||||
# - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
|
||||
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ %{ENV:CWD}$1.$3 [L]
|
||||
|
||||
# Access block for folders
|
||||
RewriteRule _(?:recycler|temp)_/ - [F]
|
||||
RewriteRule fileadmin/templates/.*\.(?:txt|ts)$ - [F]
|
||||
RewriteRule ^(?:vendor|typo3_src|typo3temp/var) - [F]
|
||||
RewriteRule (?:typo3conf/ext|typo3/sysext|typo3/ext)/[^/]+/(?:Configuration|Resources/Private|Tests?|Documentation|docs?)/ - [F]
|
||||
# Access block for folders
|
||||
RewriteRule _(?:recycler|temp)_/ - [F]
|
||||
RewriteRule fileadmin/templates/.*\.(?:txt|ts)$ - [F]
|
||||
RewriteRule ^(?:vendor|typo3_src|typo3temp/var) - [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
|
||||
# the visible content from within the `/.well-known/` hidden directory (RFC 5785).
|
||||
RewriteCond %{REQUEST_URI} "!(^|/)\.well-known/([^./]+./?)+$" [NC]
|
||||
RewriteCond %{SCRIPT_FILENAME} -d [OR]
|
||||
RewriteCond %{SCRIPT_FILENAME} -f
|
||||
RewriteRule (?:^|/)\. - [F]
|
||||
# Block access to all hidden files and directories with the exception of
|
||||
# the visible content from within the `/.well-known/` hidden directory (RFC 5785).
|
||||
RewriteCond %{REQUEST_URI} "!(^|/)\.well-known/([^./]+./?)+$" [NC]
|
||||
RewriteCond %{SCRIPT_FILENAME} -d [OR]
|
||||
RewriteCond %{SCRIPT_FILENAME} -f
|
||||
RewriteRule (?:^|/)\. - [F]
|
||||
|
||||
# Stop rewrite processing, if we are in any other known directory
|
||||
# NOTE: Add your additional local storages here
|
||||
RewriteRule ^(?:fileadmin/|typo3conf/|typo3temp/|uploads/) - [L]
|
||||
# Stop rewrite processing, if we are in any other known directory
|
||||
# NOTE: Add your additional local storages here
|
||||
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} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-l
|
||||
RewriteCond %{REQUEST_URI} ^/typo3/.*$
|
||||
RewriteRule ^typo3/(.*)$ %{ENV:CWD}typo3/index.php [QSA,L]
|
||||
|
||||
# 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}'.
|
||||
'' else ''
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-l
|
||||
RewriteRule ^.*$ %{ENV:CWD}index.php [QSA,L]
|
||||
</Directory>
|
||||
RewriteRule ^typo3/(.*)$ %{ENV:CWD}index.php [QSA,L]
|
||||
'') + ''
|
||||
|
||||
# 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$">
|
||||
SetHandler "proxy:unix:${config.services.phpfpm.pools."${domainName}".socket}|fcgi://${domainName}/"
|
||||
|
|
Loading…
Reference in a new issue