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/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;
}