Nouveau sujet Répondre Imprimer Syndication RSS 2.0

Règle url rewriting dans .htaccess

Volcan
Avatar de Spark
  • Messages : 1823
  • Inscrit : 24 Juin 2006
Message édité 3 fois, dernière édition par Spark, 12 Mai 2008, 23:32     Lien vers ce message 12 Mai 2008, 17:32
Bonsoir,

Plutôt que :

RewriteRule ^cat-([0-9]*).html index.php?p=index&cat=$1 [L]
ETC ...



j'aurrais mis :

RewriteRule ^cat-([0-9]+).html$ index.php?p=index&cat=$1 [L]
ETC ...



Parce qu'on a minimum 1 chiffre (+) et pas0 ou plus (*). Et délimiter la fin de la chaîne me parais aussi plus propre ($).


Mon site de jeux en réseau Hamachi :
http://www.jeux-reseau.fr
Le forum :
http://forum.jeux-reseau.fr
 
Volcan
Avatar de Spark
  • Messages : 1823
  • Inscrit : 24 Juin 2006
Message édité 1 fois, dernière édition par Spark, 13 Mai 2008, 0:20     Lien vers ce message 12 Mai 2008, 23:32
Il y aussi une erreur dans le code, le point n'est pas échappé, ça veut dire que l'URL de ce topic par exemple peut être :

http://www.fire-soft-board.com/fsb/sujet-8547-1html
http://www.fire-soft-board.com/fsb/sujet-8547-1ahtml
http://www.fire-soft-board.com/fsb/sujet-8547-1bhtml
http://www.fire-soft-board.com/fsb/sujet-8547-1\html
http://www.fire-soft-board.com/fsb/sujet-8547-1/html



RewriteEngine On
RewriteBase /
RewriteRule ^cat-([0-9]+)\.html$ index.php?p=index&cat=$1 [L]
RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ index.php?p=forum&f_id=$1&page=$2 [L]
RewriteRule ^topic-([0-9]+)-([0-9]+)\.html$ index.php?p=topic&t_id=$1&page=$2 [L]
RewriteRule ^profile-([0-9]+)\.html$ index.php?p=userprofile&id=$1 [L]
RewriteRule ^portail\.html$ index.php?p=portail [L]
RewriteRule ^topic-author-([0-9]+)\.html$ index.php?p=search&mode=author_topic&id=$1 [L]
RewriteRule ^topic-author-([0-9]+)-([0-9]+)\.html$ index.php?p=search&mode=author_topic&id=$1&page=$2 [L]
RewriteRule ^author-([0-9]+).html$ index.php?p=search&mode=author&id=$1 [L]
RewriteRule ^author-([0-9]+)-([0-9]+)\.html$ index.php?p=search&mode=author&id=$1&page=$2 [L]


Mon site de jeux en réseau Hamachi :
http://www.jeux-reseau.fr
Le forum :
http://forum.jeux-reseau.fr
 
Chef du projet FSB
Avatar de Genova
  • Age : 22 ans
  • Messages : 14190
  • Inscrit : 16 Septembre 2004
  Lien vers ce message 12 Mai 2008, 23:47
Je note


Cause Im as free as a bird now, And this bird you can not change. - Freebird - Lynyrd Skynyrd
There's someone in my head but it's not me. - Brain damage - Pink Floyd
I said baby, you know Im gonna leave you. - Babe I'm gonna leave you - Led Zeppelin
Father ? yes son, I want to kill you - The end - The Doors
 
Chef du projet FSB
Avatar de Genova
  • Age : 22 ans
  • Messages : 14190
  • Inscrit : 16 Septembre 2004
  Lien vers ce message 13 Mai 2008, 21:35
Sujet archivé pour la raison suivante : Bug corrigé dans la version en développement.


Cause Im as free as a bird now, And this bird you can not change. - Freebird - Lynyrd Skynyrd
There's someone in my head but it's not me. - Brain damage - Pink Floyd
I said baby, you know Im gonna leave you. - Babe I'm gonna leave you - Led Zeppelin
Father ? yes son, I want to kill you - The end - The Doors
 
Répondre


.