====== Apache Web Server ====== \\ ===== Mod Rewrite : Redirection et réécriture d'URL ===== \\ Il faut activer le module **rewrite** dans /etc/sysconfig/apache2 \\ ==== Redirection vers un sous repertoire ==== ... RewriteEngine On RewriteRule ^/$ /in/ [L,R=301] ... ==== Récriture d'URL ==== Exemple : bionateo.fr SetEnv REGISTER_GLOBALS 0 SetEnv ZEND_OPTIMIZER 1 SetEnv MAGIC_QUOTES 1 SetEnv PHP_VER 5 #-------------------------------------------------- # Répertoire : /articles/ #-------------------------------------------------- # Le serveur doit suivre les liens symboliques : Options +FollowSymlinks # Activation du module de réécriture d'URL : RewriteEngine on #-------------------------------------------------- # Règles de réécriture d'URL : #-------------------------------------------------- RewriteRule ^liste_articles.html$ index.php?p=divers&c=listearticles [L] # Article sans numéro de page : (art-RAYON_ID-ARTICLE_ID-NOM_ARTICLE.html) RewriteRule ^art-([0-9]+)-([0-9]+)-(.*)\.html$ /bionateo/article.php?r=$1&a=$2 [L] # Rayon RewriteRule ^rayon-([0-9]+)-(.*)\.html$ /bionateo/rayon.php?r=$1 [L] RewriteRule ^rayon-R([0-9]+)-M([0-9]+)-(.*)\.html$ /bionateo/rayon.php?r=$1&m=$2 [L] # Marque RewriteRule ^marque-([0-9]+)-(.*)\.html$ /bionateo/rayon.php?c=marque&m=$1 [L] # Lien pagination RewriteRule ^rayon-R([0-9]+)-P([0-9]+)-(.*)\.html$ /bionateo/rayon.php?r=$1&cp=$2 [L] RewriteRule ^rayon-R([0-9]+)-C([a-zA-Z]*)-M([0-9]+)-P([0-9]+)-(.*)\.html$ /bionateo/rayon.php?r=$1&c=$2&m=$3&cp=$4 [L] RewriteRule ^rayon-R([0-9]+)-C(\D*)-M([0-9]+)-(.*)\.html$ /bionateo/rayon.php?r=$1&c=$2&m=$3 [L]