Dans /public/ ou index.php
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 :
Code:
1 2 3 4
| RewriteEngine On
RewriteCond /public%{REQUEST_FILENAME} !-f
RewriteCond /public%{REQUEST_FILENAME} !-d
RewriteRule . index.php [L] |
/index.php :
Code:
1 2
| <?php
echo('/index.php'); |
/public/index.php :
Code:
1 2
| <?php
echo('/public/index.php'); |
/public/test.php :
Code:
1 2
| <?php
echo('/public/test.php'); |
Et mes résultats :
Code:
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 |
Résultats attendus :
Code:
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 |
Merci d'avance.