Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/URLFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ public function fixSiteURL(string $url): string
}

/**
* Ensure that the network site URL contains the /wp subdirectory.
* Ensure that the network site URL contains the /wp subdirectory and uses the current request host.
*/
public function fixNetworkSiteURL(string $url, string $path): string
{
$path = ltrim($path, '/');
$url = substr($url, 0, strlen($url) - strlen($path));

$scheme = is_ssl() ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? parse_url($url, PHP_URL_HOST);
$url = $scheme . '://' . $host . '/';

Comment on lines +59 to 62
if (substr($url, -3) !== 'wp/') {
Comment on lines 62 to 63
$url .= 'wp/';
Expand Down