From da4e18cb695d075af0c442009d00ac52c72ef963 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 13 May 2023 12:49:17 +0200 Subject: [PATCH] Fixes to routing --- index.php | 2 +- system/router.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 5f27f925..e15abb21 100644 --- a/index.php +++ b/index.php @@ -29,7 +29,7 @@ require_once SYSTEM . 'functions.php'; $uri = $_SERVER['REQUEST_URI']; if(false !== strpos($uri, 'index.php')) { - $uri = str_replace_first('index.php', '', $uri); + $uri = str_replace_first('/index.php', '', $uri); } if(0 === strpos($uri, '/')) { diff --git a/system/router.php b/system/router.php index 115eb913..879ad727 100644 --- a/system/router.php +++ b/system/router.php @@ -51,7 +51,11 @@ if (false !== $pos = strpos($uri, '?')) { $uri = rawurldecode($uri); if (BASE_DIR !== '') { $tmp = str_replace_first('/', '', BASE_DIR); - $uri = str_replace_first($tmp . '/', '', $uri); + $uri = str_replace_first($tmp, '', $uri); +} + +if(0 === strpos($uri, '/')) { + $uri = str_replace_first('/', '', $uri); } define('URI', $uri);