Skip to content

Fix subdirectory multisite wp-login.php routing and align $wpSiteUrl default#6

Open
KreigD wants to merge 2 commits intofanaticdesign:masterfrom
KreigD:KreigD-patch-1
Open

Fix subdirectory multisite wp-login.php routing and align $wpSiteUrl default#6
KreigD wants to merge 2 commits intofanaticdesign:masterfrom
KreigD:KreigD-patch-1

Conversation

@KreigD
Copy link
Copy Markdown

@KreigD KreigD commented Mar 27, 2026

Summary

This PR fixes an edge case in Herd/Valet subdirectory multisite routing where subsite login URLs can be routed as front-end page requests instead of the core login script.

Problem

In subdirectory multisite setups, requests like:

should resolve to core admin/login behavior for that subsite.
The driver already normalizes wp-admin, wp-content, and wp-includes, but not wp-login.php inside frontControllerPath().

In Herd/Valet, .php handling goes through front controller resolution logic, so missing wp-login.php normalization can cause:

  • self-redirect/login loop behavior on subsite login URLs
  • reauth redirects that never reach a real login form for some flows

Changes

  1. Normalize wp-login.php in frontControllerPath()
    Include wp-login.php in the same URI normalization branch used for wp-admin, wp-content, and wp-includes.

  2. Align default $wpSiteUrl with README guidance
    Change default from "/" to "" for vanilla installs (as documented in README), reducing path concatenation ambiguity.

Why this is safe

  • wp-login.php is a core path in the same family as other normalized WordPress core routes.
  • Existing behavior for wp-admin/network remains unchanged.
  • This improves parity between documented defaults and runtime defaults.

Reference

Observed and reproduced on Laravel Herd with WordPress multisite subdirectory install.

KreigD added 2 commits March 26, 2026 21:50
Set default $wpSiteUrl to an empty string to match README guidance for
vanilla installs
Include wp-login.php in URI normalization inside frontControllerPath() (same branch as wp-admin/wp-content/wp-includes).
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