Bonjour à tous
J'ai lu les articles de Dan chez WebmasterHub et j'ai trouvé très intéressant d'utiliser la récursivité. Je me suis donc lancé mais en ajoutant une difficulté "FATALLE": Je souhaite pouvoir ajouter du texte à la suite des variables.
par exemple:
/var1-val1-var2-val2/mon-texte-pour-compliquer.html
qui serait donc réécrit:
index.php?var1=val1&var2=val2
Mon délimiteur variables - texte serait le caractère "/"
Le processus normal serait:
1) supprimer tout ce qui est après le dernier "/" dans l'URL et rediriger sur tout ce qu'il y avait avant
2) utiliser la récurssion de Dan pour récupérer mes variables.
Séquanciellement ca devrait nous donner:
/var1-val1-var2-val2/mon-texte-pour-compliquer.html
/var1-val1-var2-val2.html
/var1-val1&var2=val2.html
/index.php?var1=val1&var2=val2
FACILLEEEE que je vous entend déja faire... ben j'y suis depuis 2heures et j'ai un comportement plustot étrange de la part d'apache.
Voici mon .htaccess:
et voila le log sorti du ModRewrite:
Vous l'avez compris, lors de la réécriture, Apache a une sérieuse tendance à me rajouter "/les=clubs.html" et à rentrer dans une boucle infinie...
J'ai essayé plusieurs choses:
d'une l'instruction:
SEULE, me redirige bien
/lang-fr-category_id-21-action-view/les-clubs.html
vers
/lang-fr-category_id-21-action-view.html
Donc apres je comprend pas trop pourquoi il me rajoute toujours des merdes à la fin... j'ai essayé des milliers de trucs et... sans succès, si quelqu'un peut m'aider
Merciiiiiii[/i]
J'ai lu les articles de Dan chez WebmasterHub et j'ai trouvé très intéressant d'utiliser la récursivité. Je me suis donc lancé mais en ajoutant une difficulté "FATALLE": Je souhaite pouvoir ajouter du texte à la suite des variables.
par exemple:
/var1-val1-var2-val2/mon-texte-pour-compliquer.html
qui serait donc réécrit:
index.php?var1=val1&var2=val2
Mon délimiteur variables - texte serait le caractère "/"
Le processus normal serait:
1) supprimer tout ce qui est après le dernier "/" dans l'URL et rediriger sur tout ce qu'il y avait avant
2) utiliser la récurssion de Dan pour récupérer mes variables.
Séquanciellement ca devrait nous donner:
/var1-val1-var2-val2/mon-texte-pour-compliquer.html
/var1-val1-var2-val2.html
/var1-val1&var2=val2.html
/index.php?var1=val1&var2=val2
FACILLEEEE que je vous entend déja faire... ben j'y suis depuis 2heures et j'ai un comportement plustot étrange de la part d'apache.
Voici mon .htaccess:
Code:
RewriteEngine on
RewriteRule (.+)/([^/]+)\.html $1\.html
RewriteRule (.+)-([^-]+)-([^-&]*)([^-]*)\.html $1&$2=$3$4\.html [N]
RewriteRule ([^-]+)-([^-]*)(.*)\.html index2.php?$1=$2$3 [L]
et voila le log sorti du ModRewrite:
Code:
rewrite lang-fr-category_id-21-action-view/les-clubs.html -> lang-fr-category_id-21-action-view.html
rewrite lang-fr-category_id-21-action-view.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html
rewrite lang-fr-category_id-21-action-view.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html
rewrite lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html/les-clubs.html -> lang-fr-category_id-21-action-view.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html.html
Vous l'avez compris, lors de la réécriture, Apache a une sérieuse tendance à me rajouter "/les=clubs.html" et à rentrer dans une boucle infinie...
J'ai essayé plusieurs choses:
d'une l'instruction:
Code:
RewriteRule (.+)/([^/]+)\.html $1\.html
/lang-fr-category_id-21-action-view/les-clubs.html
vers
/lang-fr-category_id-21-action-view.html
Donc apres je comprend pas trop pourquoi il me rajoute toujours des merdes à la fin... j'ai essayé des milliers de trucs et... sans succès, si quelqu'un peut m'aider

Merciiiiiii[/i]