Il faut d'abord savoir que par défaut pour apache, /dossier1 est un url de fichier. Il va d'abord chercher s'il existe un fichier du nom de "dossier1" à la racine du site. S'il ne le trouve pas, il va regarder si il existe un dossier du même nom, puis entrer dans ce dossier est chercher index.html (puis index.php, etc...).
J'ai fait quelques tests pour voir ce que ça donne :
- Code: Tout sélectionner
Redirect permanent /dossier1 http://www.monserveur.com/articleprecis.html
http://www.monserveur.com/dossier1 ->
http://www.monserveur.com/articleprecis.html Ça marche parfaitement
http://www.monserveur.com/dossier1/ ->
http://www.monserveur.com/articleprecis.html/ La page se charge mais pas les css ni les image
http://www.monserveur.com/dossier1/index.html ->
http://www.monserveur.com/articleprecis.html/index.html La page se charge mais pas les css ni les image
- Code: Tout sélectionner
Redirect permanent /dossier1/ http://www.monserveur.com/articleprecis.html
http://www.monserveur.com/dossier1 -> Erreur 404
http://www.monserveur.com/dossier1/ ->
http://www.monserveur.com/articleprecis.html Ça marche parfaitement
http://www.monserveur.com/dossier1/index.html ->
http://www.monserveur.com/articleprecis.htmlindex.html erreur 404
- Code: Tout sélectionner
Redirect permanent /dossier1/index.html http://www.monserveur.com/articleprecis.html
http://www.monserveur.com/dossier1 -> Erreur 404
http://www.monserveur.com/dossier1/ -> Erreur 404
http://www.monserveur.com/dossier1/index.html -> Ça marche parfaitement
Pas de solution parfaite donc. En plus, le cache du navigateur vient brouiller souvent les tests. Penser à vider le cache du navigateur
à chaque modification, même mineure pour bien voir ce qui se passe. Mettre les trois redirectionns esnemble donne des résultats encore pire, on part dans une boucle sans fin...
Bref, j'ai l'impression que si cette commande est parfaite pour rediriger des dossiers vers des dossiers et des fichiers vers des fichiers, elle est catastrophique pour rediriger un dossier vers un fichier.
__________________________________
Après de nombreuses expérimentations, j'ai trouvé quelque chose qui marche à peu près :
Créer un dossier vide /dossier1/ et utiliser l'option 2:
- Code: Tout sélectionner
Redirect permanent /dossier1/ http://www.monserveur.com/articleprecis.html
http://www.monserveur.com/dossier1 ->
http://www.monserveur.com/articleprecis.html Ça marche parfaitement
http://www.monserveur.com/dossier1/ ->
http://www.monserveur.com/articleprecis.html Ça marche parfaitement
http://www.monserveur.com/dossier1/index.html ->
http://www.monserveur.com/articleprecis.htmlindex.html erreur 404
C'est pas parfait, ça marche pour deux url sur trois, mais de toute façon, le monde a pas fait mieux,
http://www.lemonde.fr/abo/index.html ne marchant pas.