Skip to content

[6.x] Fix is_homepage when trailing slashes are enforced - #15613

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
jhhazelaar:fix-is-homepage-trailing-slashes
Oct 8, 2026
Merged

jasonvarga merged 1 commit into
statamic:6.xfrom
jhhazelaar:fix-is-homepage-trailing-slashes

Conversation

@jhhazelaar

Copy link
Copy Markdown
Contributor

Fixes #15612.

With URL::enforceTrailingSlashes() enabled, Site::absoluteUrl() keeps its trailing slash (http://test.com/), while Laravel's Request::url() never has one (http://test.com). The cascade compares the two directly, so is_homepage is never true.

This removes the trailing slash from the site URL before comparing. Without enforced trailing slashes the site URL has no trailing slash to begin with, so nothing changes there. A site in a subdirectory (http://test.com/de/) is handled the same way.

Adds tests for a homepage and a non-homepage request with trailing slashes enforced.

@jasonvarga
jasonvarga merged commit feb23ca into statamic:6.x Oct 8, 2026
62 checks passed
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.

is_homepage is always false when trailing slashes are enforced

2 participants