I try to remove this character (?) from my URI (example: www.mywebsite.com/?home to www.mywebsite.com/home) but this is working in localhost and not in production ( i got a 404 error ) what I’m doing wrong?
I’m working on PHP and MVC. This is my router with my modifications.
<?php
ob_start();
session_start();
$theGet = explode('/',$_SERVER['REQUEST_URI']);
if ( strpos($theGet[2],'&&') ){
$section = explode('&&',$theGet[2]);
$giveToGet = explode('=',$section[1]);
$_GET[$giveToGet[0]] = $giveToGet[1];
$theGet[2] = $section[0];
}
if ( isset($theGet[2]) ){
if ($theGet[2] === '') {
include_once "./views/home.view.php";
}else {
if (isset($_GET['token'])) {
$_SESSION['tokenRecup'] = $_GET['token'];
}
if (file_exists("./views/$theGet[2].view.php")) {
include_once "./views/$theGet[2].view.php";
} else {
include_once "./views/404.view.php";
}
}
$render = ob_get_clean();
include_once "./templates/base_template.php";
}else{
header('Location: ./home');
}