mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 16:40:05 +01:00
Redirect wp-admin to wp-admin/ (#96)
When attempting to access `wp-admin` unauthenticated, WordPress redirects to `wp-admin` instead of `wp-admin/` which causes issues with all the links in the admin until you add the trailing slash.
This commit is contained in:
committed by
Taylor Otwell
parent
68ff17aa59
commit
60dc951513
@@ -28,6 +28,23 @@ public function frontControllerPath($sitePath, $siteName, $uri)
|
||||
$_SERVER['PHP_SELF'] = $uri;
|
||||
$_SERVER['SERVER_ADDR'] = '127.0.0.1';
|
||||
|
||||
return parent::frontControllerPath($sitePath, $siteName, $uri);
|
||||
return parent::frontControllerPath(
|
||||
$sitePath, $siteName, $this->forceTrailingSlash($uri)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to uri with trailing slash.
|
||||
*
|
||||
* @param string $uri
|
||||
* @return string
|
||||
*/
|
||||
private function forceTrailingSlash($uri)
|
||||
{
|
||||
if (substr($uri, -1 * strlen('/wp-admin')) == '/wp-admin') {
|
||||
header('Location: '.$uri.'/'); die;
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user