From 094c67736b1140e332f4828da4beb5bff4b392fa Mon Sep 17 00:00:00 2001 From: "dorian.hodin" Date: Tue, 4 Apr 2023 08:40:57 +0200 Subject: [PATCH] Add .htaccess rule --- Source/.htaccess | 2 ++ Source/Controller/FrontController.php | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/.htaccess b/Source/.htaccess index f41aadd..fa0885f 100644 --- a/Source/.htaccess +++ b/Source/.htaccess @@ -2,12 +2,14 @@ RewriteEngine on # Vérifier si le serveur est MAMP ou WAMP RewriteCond %{DOCUMENT_ROOT} /Applications/MAMP/htdocs/ +RewriteCond %{REQUEST_URI} !/$ RewriteRule .* - [E=APP_ROOT:/SAE4.01_FORMULAIRE/] RewriteCond %{DOCUMENT_ROOT} / RewriteRule .* - [E=APP_ROOT:] # Redirection des URLs +RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [L,R=301] RewriteRule ^/$ %{ENV:APP_ROOT}index.php?page=goToForm [L] RewriteRule ^goToForm$ %{ENV:APP_ROOT}index.php?page=goToForm [L] RewriteRule ^submitForm$ %{ENV:APP_ROOT}index.php?page=submitForm [L] diff --git a/Source/Controller/FrontController.php b/Source/Controller/FrontController.php index fa035e6..76d152f 100644 --- a/Source/Controller/FrontController.php +++ b/Source/Controller/FrontController.php @@ -83,7 +83,6 @@ class FrontController protected function mapRoutes(): void { global $controller; - $this->router->setBasePath('/'); $this->router->map('GET', '/', array($controller['Candidate'], 'goToForm'), 'goToForm'); $this->router->map('POST', '/submitForm', array($controller['Candidate'], 'submitForm'), 'submitForm'); $this->router->map('POST', '/addQuestion', array($controller['Admin'], 'addQuestion'), 'addQuestion');