Change it to 
if($splitPath[0] != "dashboard" && (isset($splitPath[1]) && $splitPath[1] != "dasboard")) {
     header('Location: ../dashboard');
  }
Becase of the different directory structure types.