Déclaration du fichier htaccess pour un dossier situé à la racine
Bonjour tout le monde,
Je voudrais faire de l'url rewriting dans un dossier (information) de mon site placé à la racine. Pour cela j'ai créer un fichier .htaccess placé dans ce dossier qui est le suivant
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| #Developpement URL-Rewritting en local
#Le serveur doit suivre les liens symboliques
Options +FollowSymlinks
#Activation du module de réécriture
RewriteEngine on
#Règles de réécriture
#Pages information/information.php?choix_information=texte
RewriteRule ^information-sur-myopie\.php$ http://localhost/Afrique/information/information.php?choix_information=myopie [L] |
Dans ce dossier il y a des pages dont le nom est sur le modèle suivant information-sur-.....php
Il y a aussi une page information.php qui permet grâce à un formulaire d'appeler la bonne page et de l'afficher grâce à un include.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| <form name="formulaire" method="get" action="/Afrique/information/information.php">
<select name="choix_information" id="choix_information">
<optgroup label="Les troubles visuels">
<option value="myopie">La myopie</option>
<option value="presbytie">La presbytie</option>
<option value="hypermetropie">L'hypermetropie</option>
<option value="astigmatisme">L'astigmatisme</option>
</optgroup>
<optgroup label="Les maladies">
<option value="glaucome">Le glaucome</option>
<option value="cataracte">La cataracte</option>
</optgroup>
</select>
<input type="submit" value="Afficher"/>
</form>
<?php
if(isset($_GET['choix_information']))
{
switch($_GET['choix_information'])
{
case "myopie" : echo "<br><br>";
include("information-sur-myopie.php");
exit();
case "presbytie" : echo "<br><br>";
include("information-sur-presbytie.php");
exit();
case "hypermetropie" : echo "<br><br>";
include("information-sur-hypermetropie.php");
exit();
case "astigmatisme": echo "<br><br>";
include("information-sur-astigmatie.php");
exit();
case "glaucome" : echo "<br><br>";
include("information-sur-glaucome.php");
exit();
case "cataracte" : echo "<br><br>";
include("information-sur-cataracte.php");
exit();
}
}
?>
</div>
</body>
</html> |
En appelant la page myopie mon adresse est donc http://localhost/Afrique/information...rmation=myopie et je voudrais la transformer en http://localhost/Afrique/information...sur-myopie.php.
Le problème c'est que ça ne marche pas et je ne comprend pas pourquoi étant donnée que j'ai fait de l'url rewriting sur ce site mais à la racine. Dois je coder mon fichier .htaccess de manière différente? Ou alors est ce un problème avec l'instruction include? Je suis un peu perdu à vrai dire.
Je vous remercie de votre aide.