[resolu] ma regle ne match pas

Consultez la formation URL Rewriting et sites dynamiques de WebRankInfo / Ranking Metrics


rog
WRInaute accro
WRInaute accro
 
Messages: 1662
Inscription: Jeu Sep 21, 2006 2:32

[resolu] ma regle ne match pas

Message le Dim Déc 16, 2007 12:36

j'ai decidé d'utiliser le rewrite sur mon prochain site mais j'ai un problème avec RewriteRule,

dans le cas présent je veux juste rediriger les fr.domaine vers domaine/fr

Code: Tout sélectionner
RewriteEngine on
#RewriteBase /
RewriteCond %{HTTP_HOST} !^drague.opendmoz.info$ [NC]
RewriteCond %{HTTP_HOST} ^([a-z]*)\.drague\.opendmoz\.info$ [NC]
RewriteRule ^([a-z]*)\.drague\.opendmoz\.info$ /$1/index.php


le log

Code: Tout sélectionner
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c2bb08/initial] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/ ->
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c2bb08/initial] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri ''
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c2bb08/initial] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/index.html -> index.html
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'index.html'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/index.html
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/index.cgi -> index.cgi
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'index.cgi'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/index.cgi
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/index.pl -> index.pl
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'index.pl'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/index.pl
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/index.php -> index.php
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'index.php'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/index.php
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/index.xhtml -> index.xhtml
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'index.xhtml'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/index.xhtml
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/HEADER.html -> HEADER.html
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'HEADER.html'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#c15ad8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/HEADER.html
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f48c8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/en/ -> en/
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f48c8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'en/'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f48c8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/en/
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/en/index.html -> en/index.html
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'en/index.html'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/en/index.html
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/en/index.cgi -> en/index.cgi
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'en/index.cgi'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/en/index.cgi
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/en/index.pl -> en/index.pl
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'en/index.pl'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/en/index.pl
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/en/index.php -> en/index.php
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'en/index.php'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/en/index.php
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (3) [perdir /home/dragueur/docs/] strip per-dir prefix: /home/dragueur/docs/README.html -> README.html
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (3) [perdir /home/dragueur/docs/] applying pattern '^([a-z]*)\.drague\.opendmoz\.info$' to uri 'README.html'
192.168.0.10 - - [16/Dec/2007:20:47:41 +0100] [en.drague.opendmoz.info/sid#6ad728][rid#7f08a8/subreq] (1) [perdir /home/dragueur/docs/] pass through /home/dragueur/docs/README.html


rog
Dernière édition par rog le Dim Déc 16, 2007 16:35, édité 1 fois.


webmasterlamogere
WRInaute accro
WRInaute accro
 
Messages: 1874
Inscription: Dim Déc 17, 2006 21:08

Message le Dim Déc 16, 2007 13:33

Il n'est pas possible de faire du rewritting sur un domaine différent. la seule chose possible c'est de faire une redirection 301.
Code: Tout sélectionner
RewriteEngine on
#RewriteBase /
RewriteCond %{HTTP_HOST} !^drague\.opendmoz\.info$ [NC]
RewriteCond %{HTTP_HOST} ^([a-z]*)\.drague\.opendmoz\.info$ [NC]
RewriteRule ^(.*)$ http://drague.opendmoz.info/%1/$1 [R=301,L]


rog
WRInaute accro
WRInaute accro
 
Messages: 1662
Inscription: Jeu Sep 21, 2006 2:32

Message le Dim Déc 16, 2007 15:38

je te remercie webmasterlamogere ça marche, mais oulalala ce que c'est subtile

en fait drague.opendmoz.info est un sous domaine declaré en vhost donc apache le considère comme un domaine

j'ai bidouillé pour que *.drague.opendmoz.info pointe sur le vhost

et j'ai simplifié ta commande par

Code: Tout sélectionner
RewriteRule ^(.*)$ http://drague.opendmoz.info/%1/index.php


je pensais que la barre d'adresse IE conserverait l'url " fr.drague.opendmoz.info " parce que sinon je ne vois pas l'interêt de rewriter le sous domaine

hors :

Code: Tout sélectionner
add path info postfix: /home/dragueur/docs/fr/index.php -> /home/dragueur/docs/fr/index.php/index.php
strip per-dir prefix: /home/dragueur/docs/fr/index.php/index.php -> fr/index.php/index.php
applying pattern '^(.*)$' to uri 'fr/index.php/index.php'
RewriteCond: input='fr.drague.opendmoz.info' pattern='!^drague\.opendmoz\.info$' [NC] => matched
RewriteCond: input='fr.drague.opendmoz.info' pattern='^([a-z]*)\.drague\.opendmoz\.info$' [NC] => matched
rewrite 'fr/index.php/index.php' -> 'http://drague.opendmoz.info/fr/index.php'
implicitly forcing redirect (rc=302) with http://drague.opendmoz.info/fr/index.php
trying to replace prefix /home/dragueur/docs/ with /
escaping http://drague.opendmoz.info/fr/index.php for redirect
redirect to http://drague.opendmoz.info/fr/index.php?plm [REDIRECT/302]
strip per-dir prefix: /home/dragueur/docs/fr/index.php -> fr/index.php
applying pattern '^(.*)$' to uri 'fr/index.php'
RewriteCond: input='drague.opendmoz.info' pattern='!^drague\.opendmoz\.info$' [NC] => not-matched
pass through /home/dragueur/docs/fr/index.php


indique que mod_rewrite fais une redirection et cela implique même que l'url rewritée va passer elle aussi par rewritecond

on ne peux pas rewrité sans faire de redirection ?

rog


rog
WRInaute accro
WRInaute accro
 
Messages: 1662
Inscription: Jeu Sep 21, 2006 2:32

Message le Dim Déc 16, 2007 16:05

edit :

ça a l'air de fonctionner convenablement, l'url affichée dans le navigateur garde bien en.drague.opendmoz.info, j'ai ajouté un test d'existence de dossier

maintenant je vais attaquer la query string

rog

Code: Tout sélectionner
RewriteEngine on

RewriteBase /

RewriteCond %{HTTP_HOST} !^drague\.opendmoz\.info$ [NC]
RewriteCond %{HTTP_HOST} ^([a-z]*)\.drague\.opendmoz\.info$ [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 -d

RewriteRule ^(.*)$ %1/index.php



log

Code: Tout sélectionner
strip per-dir prefix: /home/dragueur/docs/index -> index
applying pattern '^(.*)$' to uri 'index'
RewriteCond: input='br.drague.opendmoz.info' pattern='!^drague\.opendmoz\.info$' [NC] => matched
RewriteCond: input='br.drague.opendmoz.info' pattern='^([a-z]*)\.drague\.opendmoz\.info$' [NC] => matched
RewriteCond: input='/home/dragueur/docs/br' pattern='-d' => matched
rewrite 'index' -> 'br/index.php'
add per-dir prefix: br/index.php -> /home/dragueur/docs/br/index.php
trying to replace prefix /home/dragueur/docs/ with /
strip matching prefix: /home/dragueur/docs/br/index.php -> br/index.php
add subst prefix: br/index.php -> /br/index.php
internal redirect with /br/index.php [INTERNAL REDIRECT]
strip per-dir prefix: /home/dragueur/docs/br/index.php -> br/index.php
applying pattern '^(.*)$' to uri 'br/index.php'
RewriteCond: input='br.drague.opendmoz.info' pattern='!^drague\.opendmoz\.info$' [NC] => matched
RewriteCond: input='br.drague.opendmoz.info' pattern='^([a-z]*)\.drague\.opendmoz\.info$' [NC] => matched
RewriteCond: input='/home/dragueur/docs/br' pattern='-d' => matched
rewrite 'br/index.php' -> 'br/index.php'
add per-dir prefix: br/index.php -> /home/dragueur/docs/br/index.php
initial URL equal rewritten URL: /home/dragueur/docs/br/index.php [IGNORING REWRITE]


webmasterlamogere
WRInaute accro
WRInaute accro
 
Messages: 1874
Inscription: Dim Déc 17, 2006 21:08

Message le Dim Déc 16, 2007 18:11

pour rappel :
le $1 correspond à ce qui est récupéré par (.*)
le %1 correspond à ce qui est récupéré par ([a-z]*)


rog
WRInaute accro
WRInaute accro
 
Messages: 1662
Inscription: Jeu Sep 21, 2006 2:32

Message le Lun Déc 17, 2007 2:40

@webmasterlamogere

je te remercie pour les précisions, là je galère correctement sur la suite

lol


Formation recommandée sur ce thème :

Formation URL Rewriting et sites dynamiques : apprenez comment mettre en place la réécriture d'URL, comment optimiser vos URL et profiter de vos pages dynamiques pour booster votre référencement. Formation animée par Olivier Duffez et Fabien Facériès, experts en référencement naturel.

Tous les détails sur le site Ranking Metrics : programme, prix, dates et lieux, inscription en ligne.

Lectures recommandées sur ce thème :



Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités