Get correct URL for all cases - #141
Closed
schorschii wants to merge 1 commit into
Closed
Conversation
Member
|
Thanks for reporting and for the patch, @schorschii! We picked this up in #154. The root cause is exactly what you found — Closing in favor of #154 — full credit to you for the report. |
sgiehl
added a commit
that referenced
this pull request
Jul 27, 2026
* Detect the tracked page URL from REQUEST_URI, not PATH_INFO (#141) getCurrentScriptName() builds the auto-detected page URL (the path between host and query string). It preferred $_SERVER['PATH_INFO'], which only holds the trailing path-info segment — so with front- controller / path-info routing (e.g. /dir1/page handled by dir1/index.php) the tracker recorded a truncated '/page' instead of '/dir1/page'. REQUEST_URI already contains the full requested path (PATH_INFO is always just a suffix of it), so use it as the source and drop PATH_INFO entirely; SCRIPT_NAME stays as the fallback when REQUEST_URI is absent. This also aligns the primary source with Matomo core's Url helper. Reported in #141. * Drop the ticket number from an inline test comment Keep issue references in the CHANGELOG and git history, not in code.
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
I noticed that the URL is not correctly found out in all cases.
Example URL: https://example.com/dir1/test
In this example, "dir1" is a real existing directory on the server, and "test" is a additional string appended and handled by the index.php script in this dir (via Apache rewrite). In this case, the MatomoTracker will track "/test" instead of "/dir1/test". This change fixes the behavior to correctly track "/dir1/test".
Checklist
Review