Formation par Olivier Duffez

Formation au référencement par Olivier Duffez, créateur de WebRankInfo !
Une formule efficace alliant théorie et pratique, avec une haute disponibilité des intervenants
Cette formule a déjà convaincu plusieurs centaines d'entreprises, pourquoi pas vous ?
Réservez vite votre place en ligne (convention possible pour imputer sur le budget formation)

Formation référencement Marseille

[resolu] ma regle ne match pas

Poster un nouveau sujet Imprimer cette discussion    Forum -> URL Rewriting et .htaccess   Les dernières discussions de ce forum sont disponibles au format RSS
Voir le sujet précédent :: Voir le sujet suivant  
Auteur Message
 
rog
WRInaute accro
WRInaute accro

Inscrit le: 21 Sep 2006
Messages: 1662
Localisation: sapucaia do sul (RS)

URL permanente de ce messagePosté le : Dim Déc 16, 2007 13:36    Sujet du message: [resolu] ma regle ne match pas

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:

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:

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 17:35; édité 1 fois
 
rog Visiter le site web du posteur
webmasterlamogere
WRInaute accro
WRInaute accro

Inscrit le: 17 Déc 2006
Messages: 1502
Localisation: urlrewriting.fr

URL permanente de ce messagePosté le : Dim Déc 16, 2007 14:33    Sujet du message: [resolu] ma regle ne match pas

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:
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]
 
webmasterlamogere Visiter le site web du posteur
rog
WRInaute accro
WRInaute accro

Inscrit le: 21 Sep 2006
Messages: 1662
Localisation: sapucaia do sul (RS)

URL permanente de ce messagePosté le : Dim Déc 16, 2007 16:38    Sujet du message: [resolu] ma regle ne match pas

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:

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:

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 Visiter le site web du posteur
rog
WRInaute accro
WRInaute accro

Inscrit le: 21 Sep 2006
Messages: 1662
Localisation: sapucaia do sul (RS)

URL permanente de ce messagePosté le : Dim Déc 16, 2007 17:05    Sujet du message: [resolu] ma regle ne match pas

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:

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:

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]
 
rog Visiter le site web du posteur
webmasterlamogere
WRInaute accro
WRInaute accro

Inscrit le: 17 Déc 2006
Messages: 1502
Localisation: urlrewriting.fr

URL permanente de ce messagePosté le : Dim Déc 16, 2007 19:11    Sujet du message: [resolu] ma regle ne match pas

pour rappel :
le $1 correspond à ce qui est récupéré par (.*)
le %1 correspond à ce qui est récupéré par ([a-z]*)
 
webmasterlamogere Visiter le site web du posteur
rog
WRInaute accro
WRInaute accro

Inscrit le: 21 Sep 2006
Messages: 1662
Localisation: sapucaia do sul (RS)

URL permanente de ce messagePosté le : Lun Déc 17, 2007 3:40    Sujet du message: [resolu] ma regle ne match pas

@webmasterlamogere

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

lol
 
rog Visiter le site web du posteur
 
Montrer les messages depuis:   
Revenir en haut    Forum -> URL Rewriting et .htaccess Toutes les heures sont au format GMT + 2 Heures
Page 1 sur 1 - 
Connexion
Nom d'utilisateur:    Mot de passe:      Se connecter automatiquement à chaque visite    

A lire dans l'actualité sur WRI :

En savoir plus : , .

CLIQUEZ ICI pour vous inscrire à WebRankInfo (forum, annuaire, outils...)

Connexion

© 2001-2005 phpBB Group, support français
Personnalisation : WebRankInfo ™


 ODP  Firefox  Alsacreations  annuaire webmaster Yagoort