diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 15be521a51c..08b53d17148 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -5,7 +5,7 @@ import yargs from 'yargs'; const { argv } = yargs .options({ rootPath: { - description: ' path to web assets directory', + description: ' path to public assets directory', type: 'string', requiresArg: true, required: false, @@ -20,7 +20,7 @@ const { argv } = yargs const config = [ '--rootPath', - argv.rootPath || '../../../../web/assets', + argv.rootPath || '../../../../public/assets', '--nodeModulesPath', argv.nodeModulesPath || '../../../../node_modules', ]; diff --git a/web/.htaccess b/public/.htaccess similarity index 75% rename from web/.htaccess rename to public/.htaccess index b52c3ef6928..99ed00df8d5 100644 --- a/web/.htaccess +++ b/public/.htaccess @@ -2,7 +2,7 @@ DirectoryIndex app.php RewriteEngine On - + RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] @@ -10,16 +10,16 @@ DirectoryIndex app.php RewriteRule ^(.*) - [E=BASE:%1] RewriteCond %{ENV:REDIRECT_STATUS} ^$ - RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] + RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] RewriteCond %{REQUEST_FILENAME} -f RewriteRule .? - [L] - RewriteRule .? %{ENV:BASE}/app.php [L] + RewriteRule .? %{ENV:BASE}/index.php [L] - RedirectMatch 302 ^/$ /app.php/ + RedirectMatch 302 ^/$ /index.php/ diff --git a/web/favicon.ico b/public/favicon.ico similarity index 100% rename from web/favicon.ico rename to public/favicon.ico diff --git a/public/index.php b/public/index.php new file mode 100644 index 00000000000..10878ce556f --- /dev/null +++ b/public/index.php @@ -0,0 +1,39 @@ +load(__DIR__.'/../.env'); +} + +$env = $_SERVER['APP_ENV'] ?? 'dev'; +$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)); + +if ($debug) { + umask(0000); + + Debug::enable(); +} + +if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { + Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); +} + +if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { + Request::setTrustedHosts(explode(',', $trustedHosts)); +} + +$kernel = new Kernel($env, $debug); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/web/robots.txt b/public/robots.txt similarity index 100% rename from web/robots.txt rename to public/robots.txt diff --git a/web/app.php b/web/app.php deleted file mode 100644 index f63bb7bda8e..00000000000 --- a/web/app.php +++ /dev/null @@ -1,30 +0,0 @@ -handle($request); -$response->send(); - -$kernel->terminate($request, $response); diff --git a/web/app_dev.php b/web/app_dev.php deleted file mode 100644 index ec4c8458a29..00000000000 --- a/web/app_dev.php +++ /dev/null @@ -1,46 +0,0 @@ -handle($request); -$response->send(); - -$kernel->terminate($request, $response); diff --git a/web/app_staging.php b/web/app_staging.php deleted file mode 100644 index 812810fb3c3..00000000000 --- a/web/app_staging.php +++ /dev/null @@ -1,30 +0,0 @@ -handle($request); -$response->send(); - -$kernel->terminate($request, $response); diff --git a/web/app_test.php b/web/app_test.php deleted file mode 100644 index 296ff2cd919..00000000000 --- a/web/app_test.php +++ /dev/null @@ -1,41 +0,0 @@ -handle($request); -$response->send(); - -$kernel->terminate($request, $response); diff --git a/web/app_test_cached.php b/web/app_test_cached.php deleted file mode 100644 index 05cc0cafd20..00000000000 --- a/web/app_test_cached.php +++ /dev/null @@ -1,38 +0,0 @@ -handle($request); -$response->send(); - -$kernel->terminate($request, $response);