File: D:/HostingSpaces/SBogers10/lc-hydraulics.komma.nl/routes/oldRoutes.php
<?php
// Redirect old routes
$location = '';
$path = \Request::path();
// Wildcard redirectOldRoutes
if(starts_with($path, ['lc-hydraulics', 'lacom-machinefabriek', 'en/lacom-machinefabriek','de/lacom-machinefabriek','en/lc-hydraulics','de/lc-hydraulics'])) redirectOldRoute(null, 302, config('site.domains.lacom')[0]);
// All other old routes point to home
if(starts_with($path, ['lc-hydraulics', 'lacom-machinefabriek', 'en', 'de' ])) redirectOldRoute('/', 302);
// Redirect the old route
function redirectOldRoute($location, $responseCode = 302, $sitePath = null)
{
if(!isset($sitePath)) $sitePath = config('site.domains.lacom')[0];
$sitePath = 'http://' . $sitePath;
if(isset($location) && $location!= '/') $location = $sitePath. '/' . $location;
else $location = $sitePath;
header('location: '.$location, true, $responseCode);
exit;
}