Bonjour,
Je développe en local donc je peux donner du code mais pas de lien. L'architecture est le MVC.
Le principe est de rediriger toutes les urls vers index.php.
Le fichier .htaccess placé à la racine contient cette règle :
RewriteRule ^.*$ /index.php [QSA,L]
Puis index.php analyse l’URL et appelle le bon controller
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| $request_uri = mb_strtolower($_SERVER['REQUEST_URI']);
// analyse du path
$path = parse_url($request_uri, PHP_URL_PATH);
if ($path === false) {
echo 'URL malformée';
exit;
}
// remove the first slash
$path = mb_substr($path, 1);
$parts = explode('/', $path);
include 'config/routing.php';
$ctrl_name = getController($path);
$ctrl->invoke(); |
Mon souci est que la redirection vers index.php ne se fait pas.
Comment corriger cela ?
Partager