Bug #90579
closedRedirects module only works on URLs with trailing slashes
0%
Description
As an editor, I want to be create a redirect from "/source-path/" to "/source-path" (remove the trailing slash).
This leads to an infinite redirect loop.
Updated by Markus Klein over 4 years ago
Please post your Site configuration as well.
Updated by Florian Grell over 4 years ago
base: / baseVariants: { } disableStaticFileCache: false errorHandling: - errorCode: '404' errorHandler: Page errorContentSource: 't3://page?uid=50' languages: - title: Deutsch enabled: true languageId: '0' base: / typo3Language: default locale: de_DE iso-639-1: de navigationTitle: '' hreflang: de-DE direction: '' flag: de - title: Englisch enabled: true languageId: '2' base: /en/ typo3Language: default locale: en_US iso-639-1: en navigationTitle: '' hreflang: '' direction: '' fallbackType: strict fallbacks: '1' flag: en-us-gb rootPageId: 1 routeEnhancers: NewsPlugin: type: Extbase extension: News plugin: Pi1 routes: - routePath: '/' _controller: 'News::list' - routePath: '/{news_title}' _controller: 'News::detail' _arguments: news_title: news - routePath: '/{page}' _controller: 'News::list' _arguments: page: '@widget_0/currentPage' defaultController: 'News::list' defaults: page: '0' requirements: page: '\d+' aspects: page: type: StaticRangeMapper start: '1' end: '100' news_title: type: PersistedAliasMapper tableName: tx_news_domain_model_news routeFieldName: path_segment CoursePlugin: type: Extbase limitToPages: - 44 extension: MyExtkey plugin: Myplugin routes: - routePath: '/{number}' _controller: 'Myplugin::detail' _arguments: number: number aspects: number: type: MypluginValueMapper PageTypeSuffix: type: PageType map: sitemap.xml: 1533906435 routes: { }
Updated by Florian Grell over 4 years ago
I believe the problematic code is in the RedirectService, Lines 67-69:
if (!empty($allRedirects[$domainName]['flat'][rtrim($path, '/') . '/'])) {
$possibleRedirects = $allRedirects[$domainName]['flat'][rtrim($path, '/') . '/'];
}
Updated by Georg Ringer 5 months ago
- Sprint Focus set to Needs Decision
IMO this is not a bug. you could use https://packagist.org/packages/studiomitte/redirect2trailingslash to redirect to the version with slash.
is that ok for you?
Updated by Georg Ringer 5 months ago
- Status changed from Accepted to Needs Feedback
Updated by Florian Grell 5 months ago
Georg Ringer wrote in #note-5:
IMO this is not a bug. you could use https://packagist.org/packages/studiomitte/redirect2trailingslash to redirect to the version with slash.
is that ok for you?
That would be the opposite of what I was trying to accomplish.
If I remember correctly my use-case was: I have a page with the URL "/somepage". Some external page has a link to this page, but they link to it with a trailing slash ("/somepage/") and I want to create a redirect to the url without the slash.
Updated by Benni Mack 5 months ago
- Status changed from Needs Feedback to Closed
Hey Florian,
please check out https://b13.com/blog/to-slash-or-not-to-slash-the-significance-of-trailing-slashes-in-urls
This blog article also shows two extensions "de-slash" and "slash-force", I suggest you make use of one of them, as it solves all use-cases our clients had.