HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers14/coeveringmatrijzen.nl/app/Coevering/Routes/RouteResolver.php
<?php

namespace Coevering\Routes;

use Illuminate\Support\Facades\Redirect;

class RouteResolver
{
    public function resolve()
    {
        if( \Str::startsWith(\Request::getHttpHost(), 'www'))
        {

            $url = substr(\Request::getHttpHost(),4);
            $path = \Request::path();
            if( ! empty($path) && $path != '/') $url .= '/' . $path;

            header ('HTTP/1.1 301 Moved Permanently');
            header('location: http://' . $url );
            exit;
        }


        // SEO routes
        \Route::get('sitemap.xml', ['uses'=>'Coevering\Seo\SEOController@sitemap']);
        \Route::get('robots.txt', ['uses'=>'Coevering\Seo\SEOController@robots']);

        \Route::get('index.html', function (){
           return Redirect::to('/'); 
        });

        // Get URI
        $uri = \Request::path();

        // Check if page exists
        if( ! \Lang::has('app/routes.' . $uri))
        {
            header('HTTP/1.0 404 Not Found');
            return false;
        }

        // Resolve route
        $controllerWithMethod = \Lang::get('app/routes.' . $uri);
        \Route::get($uri, ['uses' => $controllerWithMethod ]);
    }
}