<!DOCTYPE html>
<html lang="en">
  <body>
    <?php
    //Check if it is subdomain
    $uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
    $uri_segments = explode('/', $uri_path);
    
    $url0 = array_reverse($uri_segments);
    $url = $url0[0];
    $st = $uri_segments[1];
    if (strstr($st, '.html')) {
      $st = substr($st, 0, -5);
    }
    
    $stArray = $sql = @mysql_fetch_assoc(mysql_query("SELECT page_url FROM wl_meta_tags WHERE is_fixed='L' AND LOWER(page_url)='" . strtolower($st) . "'"));
    if (is_array($stArray) & !empty($stArray) && $st != 'sitepanel' && count($uri_segments) > 2) {
      $redirectUrl = "https://www.webpulsesolution.net/" . $st . "/" . $url;
      ?>
      <script type="text/javascript">window.location.href = '<?php echo $redirectUrl; ?>';</script>
      <?php
      exit;
    }elseif(count($uri_segments) > 2 && $st != 'sitepanel'){
      $redirectUrl = "https://www.webpulsesolution.net/" . $url;
      ?>
      <script type="text/javascript">window.location.href = '<?php echo $redirectUrl; ?>';</script>
      <?php
      exit;
    } else {
      ?>
      <script type="text/javascript">window.location.href = 'https://www.webpulsesolution.net/directory';</script>
      <?php
    }
    ?>
  </body>
</html>