Pin URL root to APP_URL outside local/testing (base-folder hosting on Strato)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lars StommerandClaude Opus 5.5 committed 2026-10-22 16:32:40 +02:00
1 parent 92c796de2e
commit f031b3c854
1 file changed
+7 -1
+7 -1
View File
@@ -2,6 +2,7 @@
namespace App\Providers;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@@ -19,6 +20,11 @@ public function register(): void
*/
public function boot(): void
{
//
// On Strato the domain points at the deployment folder and .htaccess forwards to current/public;
// without a fixed root, some URLs (e.g. /sitemap.xml) would be generated with /current/public.
if (! $this->app->environment('local', 'testing')) {
URL::forceRootUrl(config('app.url'));
URL::forceScheme(parse_url((string) config('app.url'), PHP_URL_SCHEME) ?: 'https');
}
}
}