Bonjour,
Question toute bête, comment dire à apache à travers un .htaccess que s'il ne trouve pas la ressource demandée dans un sous-dossier donné alors il doit charger le fichier index.php à la racine du dossier web ?
Mon arborescence :
/.htaccess
/index.php
/public/
/public/index.php
/public/test.php
Mon htaccess :
/index.php :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 RewriteEngine On RewriteCond /public%{REQUEST_FILENAME} !-f RewriteCond /public%{REQUEST_FILENAME} !-d RewriteRule . index.php [L]
/public/index.php :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2<?php echo('/index.php');
/public/test.php :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2<?php echo('/public/index.php');
Et mes résultats :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2<?php echo('/public/test.php');
Résultats attendus :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 http://www.sandbox.tld/ -> /index.php http://www.sandbox.tld/index.php -> /index.php http://www.sandbox.tld/test.php -> /index.php http://www.sandbox.tld/toto.php -> /index.php
Merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 http://www.sandbox.tld/ -> /public/index.php http://www.sandbox.tld/index.php -> /public/index.php http://www.sandbox.tld/test.php -> /public/test.php http://www.sandbox.tld/toto.php -> /index.php
Partager