Skip to content

Commit 6ea416a

Browse files
MAGETWO-46636: Nginx doesn't redirect to setup page when using port
1 parent 94c3547 commit 6ea416a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/internal/Magento/Framework/App/SetupInfo.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,13 @@ public function isAvailable()
147147
{
148148
$setupDir = $this->getDir($this->projectRoot);
149149
$isSubDir = false !== strpos($setupDir . '/', $this->docRoot . '/');
150-
// Setup is not accessible from pub folder MAGETWO-52799
151-
$setupDir = str_replace('/pub/', '/', $setupDir);
150+
// Setup is not accessible from pub folder
151+
$setupDir = rtrim($setupDir, '/');
152+
$lastOccurrence = strrpos($setupDir, '/pub/setup');
153+
154+
if (false !== $lastOccurrence) {
155+
$setupDir = substr_replace($setupDir, '/setup', $lastOccurrence, strlen('/pub/setup'));
156+
}
152157

153158
return $isSubDir && realpath($setupDir);
154159
}

0 commit comments

Comments
 (0)