Project

General

Profile

Actions

Bug #88544

open

Trailing slash gets added to "homepage" urls if base is without trailing slash

Added by Altan Tosun almost 5 years ago. Updated over 4 years ago.

Status:
Accepted
Priority:
Must have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2019-06-12
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

While using language prefixes within the URL like /de, the canonical URL is always ending with a trailing slash (/de/)

TYPO3 version: 9.5.7


Related issues 3 (2 open1 closed)

Related to TYPO3 Core - Bug #90045: Sitemap Errors if the language has no trailing slash at the end like /de it is linked in the sitemap like /de/Needs Feedback2020-01-02

Actions
Related to TYPO3 Core - Bug #90151: ContentObjectRenderer typoLink language link is generated witch /New2020-01-19

Actions
Related to TYPO3 Core - Bug #89091: Page with a slug with trailing slash results in 404ClosedStefan Bürk2019-09-05

Actions
Actions #1

Updated by Richard Haeser over 4 years ago

  • Status changed from New to Needs Feedback

Atlan,

The canonical link is created like all other links, so I guess all links have a trailing slash in your situation? Can you give me some more background information of your case?

Actions #2

Updated by Kevin Appelt over 4 years ago

  • Subject changed from Trailing slash while using canoinical URL to Trailing slash gets added to "homepage" urls if base is without trailing slash
  • Category changed from SEO to Link Handling, Site Handling & Routing
  • Status changed from Needs Feedback to Accepted
  • Priority changed from Should have to Must have

I can confirm the issue.

v9 /en/
<link rel="canonical" href="https://typo3-9.ddev.site/en/&quot;/>

v9 /en
<link rel="canonical" href="https://typo3-9.ddev.site/en/&quot;/> => which resolves to a 307 to https://typo3-9.ddev.site/en

v10 (current master) /en/
<link rel="canonical" href="https://typo3-master.ddev.site/en/&quot;/>

v10 (current master) /en
<link rel="canonical" href="https://typo3-master.ddev.site/en/&quot;/> => which resolves to a 307 to https://typo3-master.ddev.site/en

Especially for the canonicals this 307 redirect is very unfortunate.

Conclusion
  1. This problem is within the url generation of TYPO3 and not only related to the canonical.
  2. This problem is not related to a special TYPO3 or PHP Version.
  3. This problem is only related to the "homepage" of a site, but not to subpages.

Suggestions
https://example.org/ <— (root resource, ending with slash)
https://example.org/en/whatever <— correct
https://example.org/en/whatever/ <— not correct

Domain | Site Language Base | Slug
https://example.org | /en | / —> https://example.org/en
https://example.org | /en/ | / —> https://example.org/en
https://example.org | / | / —> https://example.org/

https://example.org | /en | /subpage —> https://example.org/en/subpage
https://example.org | /en/ | /subpage —> https://example.org/en/subpage
https://example.org | / | /subpage —> https://example.org/subpage

https://example.org | /en | /subpage/ —> https://example.org/en/subpage
https://example.org | /en/ | /subpage/ —> https://example.org/en/subpage
https://example.org | / | /subpage/ —> https://example.org/subpage

Enforced Trailing Slash for all urls via custom RouteEnhancer only
Trailing slash without enforcement should redirect via 307 to no trailing slash

Actions #3

Updated by Guido Schmechel over 4 years ago

  • Related to Bug #90045: Sitemap Errors if the language has no trailing slash at the end like /de it is linked in the sitemap like /de/ added
Actions #4

Updated by Timo Poppinga over 4 years ago

  • Related to Bug #90151: ContentObjectRenderer typoLink language link is generated witch / added
Actions #5

Updated by Sybille Peters over 3 years ago

  • Related to Bug #89091: Page with a slug with trailing slash results in 404 added
Actions

Also available in: Atom PDF