Replies: 1 comment 4 replies
-
@scuba303 You have to add a Note: I changed the TLD to <?php
declare(strict_types=1);
use Valet\Drivers\LaravelValetDriver;
class LocalValetDriver extends Typo3ValetDriver
{
protected $documentRoot = '/public';
/**
* Determine if the driver serves the request.
*/
public function serves($sitePath, $siteName, $uri)
{
return true;
}
/**
* Get the fully resolved path to the application's front controller.
*/
public function frontControllerPath($sitePath, $siteName, $uri)
{
// without modifying the URI, redirect if necessary
$this->handleRedirectBackendShorthandUris($uri);
// from now on, remove trailing / for convenience for all the following join operations
$uri = rtrim($uri, '/');
if (file_exists($absoluteFilePath = $sitePath.$this->documentRoot.$uri)) {
if (is_dir($absoluteFilePath)) {
if (file_exists($absoluteFilePath.'/index.php')) {
// this folder can be served by index.php
return $this->serveScript($sitePath, $siteName, $uri.'/index.php');
}
if (file_exists($absoluteFilePath.'/index.html')) {
// this folder can be served by index.html
return $absoluteFilePath.'/index.html';
}
} elseif (pathinfo($absoluteFilePath, PATHINFO_EXTENSION) === 'php') {
// this file can be served directly
return $this->serveScript($sitePath, $siteName, $uri);
}
} elseif(str_contains($uri, '/typo3/')) {
return $this->serveScript($sitePath, $siteName, '/typo3/index.php');
}
return $this->serveScript($sitePath, $siteName, '/index.php');
}
private function handleRedirectBackendShorthandUris($uri)
{
if (rtrim($uri, '/') === '/typo3/install') {
header('Location: /typo3/sysext/install/Start/Install.php');
exit();
}
}
private function serveScript($sitePath, $siteName, $uri)
{
$docroot = $sitePath.$this->documentRoot;
$abspath = $docroot.$uri;
$_SERVER['SERVER_NAME'] = $siteName.'.loc';
$_SERVER['DOCUMENT_ROOT'] = $docroot;
$_SERVER['DOCUMENT_URI'] = $uri;
$_SERVER['SCRIPT_FILENAME'] = $abspath;
$_SERVER['SCRIPT_NAME'] = $uri;
$_SERVER['PHP_SELF'] = $uri;
return $abspath;
}
} and change the corresponding Nginx file for the domain to:
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hi. in the latest version of typo3 v11 the rewrite for accessing the backend changed.
https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.0/Breaking-93048-BackendURLRewrites.html
i tried to adjust the /opt/homebrew/etc/nginx/valet/valet.conf like advised in the above link.
also tried this version:
https://markus-code.com/2021/03/typo3-11-upgrade-backend-404-not-found/
ended up in
`location ~ /typo3 {
rewrite ^([^.]*[^/])$ $1/ permanent;
}
location /typo3/ {
absolute_redirect off;
try_files $uri /typo3/index.php$is_args$args;
}
`
all with the same result: 404
it might have issues with the driver?!
Beta Was this translation helpful? Give feedback.
All reactions