Skip to content

[6.x] Respect addTrailingSlashesToUrls for base URLs - #19723

Merged
brandonkelly merged 3 commits into
6.xfrom
rias/cms-1395-respect-addtrailingslashestourls-for-base-urls
Sep 28, 2026
Merged

brandonkelly merged 3 commits into
6.xfrom
rias/cms-1395-respect-addtrailingslashestourls-for-base-urls

Conversation

@riasvdv

@riasvdv riasvdv commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Description

Base site URLs ignored addTrailingSlashesToUrls: url(''), siteUrl(''), and homepage element URLs always ended with a trailing slash, because the setting was only applied when a path was present.

Empty-path site URLs now drop the base URL’s trailing slash unless addTrailingSlashesToUrls is enabled. Control panel URLs are unchanged, and a root-relative base URL of / stays /.

The siteUrl Twig variable still always ends with a trailing slash, so templates like {{ siteUrl }}some/path keep working.

Since the setting defaults to false, homepage URLs and an empty postLogoutRedirect now resolve to the slashless site root by default, which also matches Laravel’s url('/').

Related issues

url(''), siteUrl(''), and homepage element URLs now drop the base URL's
trailing slash unless addTrailingSlashesToUrls is enabled. The siteUrl
Twig global keeps its trailing slash.
@linear-code

linear-code Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

CMS-1395

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

πŸ“š Storybook previews

@craftcms/ui β€” open Storybook

No changed components detected in this Storybook.

resources/js β€” open Storybook

No changed components detected in this Storybook.

@riasvdv
riasvdv marked this pull request as ready for review September 28, 2026 08:23
@brandonkelly
brandonkelly merged commit dfa991f into 6.x Sep 28, 2026
23 checks passed
@brandonkelly
brandonkelly deleted the rias/cms-1395-respect-addtrailingslashestourls-for-base-urls branch September 28, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants