diff --git a/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php b/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php index 8b7343ab3e8a..76d0b44bf891 100644 --- a/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php +++ b/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php @@ -15,8 +15,15 @@ class SetRequestForConsole */ public function bootstrap(Application $app) { - $app->instance('request', Request::create( - $app->make('config')->get('app.url', 'http://localhost'), 'GET', [], [], [], $_SERVER - )); + $uri = $app->make('config')->get('app.url', 'http://localhost'); + $components = parse_url($uri); + $server = $_SERVER; + + if (isset($components['path'])) { + $server['SCRIPT_FILENAME'] = $components['path']; + $server['SCRIPT_NAME'] = $components['path']; + } + + $app->instance('request', Request::create($uri, 'GET', [], [], [], $server)); } }