[resolu] ma regle ne match pas
6 messages • Page 1 sur 1
Consultez la formation URL Rewriting et sites dynamiques de WebRankInfo / Ranking Metrics
[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
le log
rog
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

- Messages: 1874
- Inscription: Dim Déc 17, 2006 21:08
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]
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
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 :
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
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
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
log
ç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

- Messages: 1874
- Inscription: Dim Déc 17, 2006 21:08
pour rappel :
le $1 correspond à ce qui est récupéré par (.*)
le %1 correspond à ce qui est récupéré par ([a-z]*)
le $1 correspond à ce qui est récupéré par (.*)
le %1 correspond à ce qui est récupéré par ([a-z]*)
6 messages • Page 1 sur 1
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 :
- overture precision match et overture site match
- [Résolu] Erreur 500, problème sur une regle
- Match () AGAINST () et MySQL
- Site Match
- Match France Vs Maroc.
- Match Google / MSN
- yahoo site match
- SELECT MATCH COLLATE et accent
- Yooda Match density et balise A
- indexation gratuite ou site match
- Warning: preg_match() [function.preg-match]:
- info sur requete mysql MATCH () AGAINST()
- Search Submit Basic et Site Match
- [Réglé] Exclure une URL d'une règle de réécriture
- Est-ce que j'ai le droit d'utiliser un phrase match du genre
Qui est en ligne
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités


le forum