[6.x] Respect addTrailingSlashesToUrls for base URLs - #19723
Merged
brandonkelly merged 3 commits intoSep 28, 2026
Merged
brandonkelly merged 3 commits into
brandonkelly merged 3 commits into
Conversation
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.
Contributor
π 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
marked this pull request as ready for review
September 28, 2026 08:23
brandonkelly
deleted the
rias/cms-1395-respect-addtrailingslashestourls-for-base-urls
branch
September 28, 2026 12:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
addTrailingSlashesToUrlsis enabled. Control panel URLs are unchanged, and a root-relative base URL of/stays/.The
siteUrlTwig variable still always ends with a trailing slash, so templates like{{ siteUrl }}some/pathkeep working.Since the setting defaults to
false, homepage URLs and an emptypostLogoutRedirectnow resolve to the slashless site root by default, which also matches Laravelβsurl('/').Related issues
addTrailingSlashesToUrlsΒ #5675