Browse Source

Fix issue when SITE_PATH is /

Skylar Ittner 10 months ago
parent
commit
ef847a13c1
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      index.php

+ 6
- 1
index.php View File

@@ -16,7 +16,12 @@ require_once __DIR__ . "/required.php";
16 16
 <script src="<?php echo SITE_PATH; ?>js/bootstrap.min.js"></script>
17 17
 
18 18
 <?php
19
-$pathbits = explode("/", str_replace(SITE_PATH, "", $_SERVER['REQUEST_URI']));
19
+$path = $_SERVER['REQUEST_URI'];
20
+$pos = strpos($_SERVER['REQUEST_URI'], SITE_PATH);
21
+if ($pos !== false) {
22
+    $path = substr_replace($_SERVER['REQUEST_URI'], "", $pos, strlen(SITE_PATH));
23
+}
24
+$pathbits = explode("/", $path);
20 25
 $pageid = $pathbits[0];
21 26
 $arg1 = isset($pathbits[1]) ? $pathbits[1] : "";
22 27
 $arg2 = isset($pathbits[2]) ? $pathbits[2] : "";