Skip to content

fix: match routes against the app's own base path for subfolder installs - #126

Merged
benkhalife merged 1 commit into
masterfrom
fix/subfolder-install-route-matching
Sep 19, 2026
Merged

benkhalife merged 1 commit into
masterfrom
fix/subfolder-install-route-matching

Conversation

@benkhalife

Copy link
Copy Markdown
Member

Route::run() matched against the raw REQUEST_URI, so an app installed under a subdirectory (e.g. http://example.com/blog/) 404'd on every route unless each one was hand-prefixed with the install folder name.

Url::base() already detected the subdirectory correctly for link generation; that detection is now exposed as Url::basePath() and used by a new Url::requestPath(), which strips it from the incoming URI before matching. Route::run() matches against requestPath() instead of uri(). Vite's production asset URLs are prefixed with the same base path so built CSS/JS resolve correctly too.

Root installs are unaffected: basePath() is empty in that case, so requestPath() is identical to uri().

Route::run() matched against the raw REQUEST_URI, so an app installed
under a subdirectory (e.g. http://example.com/blog/) 404'd on every
route unless each one was hand-prefixed with the install folder name.

Url::base() already detected the subdirectory correctly for link
generation; that detection is now exposed as Url::basePath() and used
by a new Url::requestPath(), which strips it from the incoming URI
before matching. Route::run() matches against requestPath() instead of
uri(). Vite's production asset URLs are prefixed with the same base
path so built CSS/JS resolve correctly too.

Root installs are unaffected: basePath() is empty in that case, so
requestPath() is identical to uri().
@benkhalife
benkhalife merged commit 09c69f8 into master Sep 19, 2026
2 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.

1 participant