当所有语言都以语言 slug 作为基础配置时,TYPO3 重定向关于基础/导致 404
TYPO3 redirects regarding base / leading to 404 when all languages are configured with language slug as base
当所有语言都配置了语言 slug 作为基础 /de/
、/en/
等时,我如何在 TYPO3 v9 重定向模块中配置关于基础 /
的重定向?
我的问题是 source_path
的重定向,例如 /something
导致 404。
我检查了 xdebug。出现404是因为处理后的$route
没有语言信息,在config.yaml
中设置了key languages:
但是这里因为定义的base不匹配。
为了更清楚地说明一些例子:
- 所有现有页面都可以访问,例如
http://typo3.demo.local:3000/de/example1/
http://typo3.demo.local:3000/en/example1/
等等
- 普通基础 url
http://typo3.demo.local:3000/
默认重定向到默认语言 http://typo3.demo.local:3000/de/
- 在 TYPO3 v9 重定向模块中,重定向应该遵循从
http://typo3.demo.local:3000/test1/
到 http://typo3.demo.local:3000/de/example1/
但是没有重定向,它显示来自 404 页面的内容http://typo3.demo.local:3000/test1/
这已经在 https://forge.typo3.org/issues/87455#note-7
中讨论了一段时间
所以切换到具有功能开关的 typo3 10 或使用我从 forge 问题复制的解决方法:
return [ 'frontend' => [ 'typo3/cms-redirects/redirecthandler' => [ 'disabled' => true, ], 'hotfix-redirecthandler' => [ 'target' => \TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler::class, 'before' => [ 'typo3/cms-frontend/base-redirect-resolver', ], ], ], ];
在 Configuration/RequestMiddlewares.php
的分机中
当所有语言都配置了语言 slug 作为基础 /de/
、/en/
等时,我如何在 TYPO3 v9 重定向模块中配置关于基础 /
的重定向?
我的问题是 source_path
的重定向,例如 /something
导致 404。
我检查了 xdebug。出现404是因为处理后的$route
没有语言信息,在config.yaml
中设置了key languages:
但是这里因为定义的base不匹配。
为了更清楚地说明一些例子:
- 所有现有页面都可以访问,例如
http://typo3.demo.local:3000/de/example1/
http://typo3.demo.local:3000/en/example1/
等等 - 普通基础 url
http://typo3.demo.local:3000/
默认重定向到默认语言http://typo3.demo.local:3000/de/
- 在 TYPO3 v9 重定向模块中,重定向应该遵循从
http://typo3.demo.local:3000/test1/
到http://typo3.demo.local:3000/de/example1/
但是没有重定向,它显示来自 404 页面的内容http://typo3.demo.local:3000/test1/
这已经在 https://forge.typo3.org/issues/87455#note-7
中讨论了一段时间所以切换到具有功能开关的 typo3 10 或使用我从 forge 问题复制的解决方法:
return [ 'frontend' => [ 'typo3/cms-redirects/redirecthandler' => [ 'disabled' => true, ], 'hotfix-redirecthandler' => [ 'target' => \TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler::class, 'before' => [ 'typo3/cms-frontend/base-redirect-resolver', ], ], ], ];
在 Configuration/RequestMiddlewares.php