Ticket #426 (closed defect: worksforme)
smart+question
| Reported by: | christophe | Owned by: | anonymous |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Autres | Version: | alternc-0.9.3 |
| Severity: | block | Keywords: | |
| Cc: |
Description
http://alternc.org/marchives/users/2004-January/000121.html
comment avoir un mod_rewrite en etat de marche ?
Une solution??
merci
Change History
comment:2 Changed 8 years ago by christophe
la n'est pas le probleme le mod rewrite est incompatible avec la directive virutaldocumentroot
Parce que le modrewrite ne marche qu'avec des parametres complet et non avec des variable
les symptomes sont les suivants avec la regle suivante " RewriteRule? index/contact/info.htm$ index.php?type=$1&data=$2 "
aucune valeur n'est atribuer a $1 et $2
alors accrochez vous
inutile de changer de version c tjr la meme chose
et aucune donnée a ce sujet n'est disponible avec mes amis moteur de recherche
comment:3 Changed 8 years ago by christophe
en clair index = index.php
/contact = parametre 1 ($1)
/info.htm = parametre 2 ($2)
comment:4 Changed 8 years ago by christophe
alors j aimerais avoir une solution qui tourne impecable
comment:5 Changed 8 years ago by anarcat
je ne suis pas sûr que je comprends le problème ici, mais dans tous les cas, ceci fonctionnera mieux sans mod_vhost_alias... cf. #429
comment:6 Changed 8 years ago by christophe
je reexplique
dans votre config d'apache vous utiliser la directive VirtualDocumentRoot? du module mod_alias_vhost avec des variables %0 %1 %2.
quand on active aussi le mod_rewrite, les variables du modrewrite ($0 $1 $2 $3) ont aucune valeur.
ceci est bloquand pour tout site qui utilise le mod_rewrite par repertoire (.htaccess)
les redirections avec des parametre ne fonctionne pas
Lorsque je teste avec la directive DocumentRoot? /var/alternc/dns/d/domaine/www.domaine.tld toutes les rewriterules fonctionne.
C'est un probleme serieux
comment:7 Changed 8 years ago by anarcat
oui, c'est un véritable problème. Cependant, pour le régler, il faudrait se débarrasser de mod_vhost_alias, ce qui n'est pas une mince affaire.
comment:8 Changed 8 years ago by christophe
Il reste a explorer les options.
-utiliser le modrewrite a 100% -utiliser un fichier conf par vhost avec ou sans map -utiliser .... ( je recherche des info sur le forum de apachefrance.org http://www.apachefrance.com/Forums/index.php?showtopic=857&st=0&#entry17199 )
comment:9 Changed 8 years ago by arnaud_lb
- 4. Lire la doc du rewrite_mod ?
Le mod_rewrite n'a rien à voir avec le mod_vhost_alias.
Le mod_vhost_alias fournis la directive VirtualDocumentRoot?, qui nous permet de changer le DocumentRoot? de façon dynamique par rapport au nom d'hote.
Le rewrite_mod permet de réécrire l'URL demandée, ce qui permet par exemple de transformer /page-1.html en /page.php?pageid=1. La réécriture se fait à l'aide d'une expression régulière, il faut donc utililiser des masques pour remplir tes variables:
RewriteRule? page-([0-9]+).html$ page.php?pageid=$1
http://www.apachefrance.com/Manuels/Apache_1.3_VF/mod/mod_rewrite.html
Là ou le mod_vhost_alias pose problème, c'est qu'il cause un bug dans le mod_rewrite: le chemin complet est ajouté 2 fois à l'URL réécrite. Donc au lieu de faire: page-1.html => page.php?pageid=1 => /var/alternc/dns/t/test.test.com/page.php ça fait: page-1.html => /var/alternc/dns/t/test.test.com/page.php?pageid=1 => /var/alternc/dns/t/test.test.com/var/alternc/dns/t/test.test.com/page.php Ce qui produit une erreur 404
Pour contourner ce problème, on peut ajouter une règle RewriteBase?. Ici page.php est à la racine du site, donc si on met "RewriteBase? /", ça passe.
modifié le : 03/05/05 09:14
comment:10 Changed 8 years ago by anarcat
- Status changed from new to assigned
Ça me semble être une explication saine et complète. Christophe, je vais fermer le bug, à moins que ça ne fonctionne pas...
comment:11 Changed 8 years ago by christophe
salut anarcat
non pour moi c est pas resolue
les deux ensemble ne fonctionnent pas a present
donc que faire ?
comment:12 Changed 8 years ago by arnaud_lb
Tu as quoi exactement comme RewriteRule? ? Tu obtient quoi comme erreur ? le fichier de logs dit quoi ?
comment:13 Changed 8 years ago by christophe
arnaud les variables du rewriterules $[0-9] = "". elles sont toujour vides quand on utilise les mod vhoast_alias et rewrite
tu peux verifier si tu veux j ai 100% de reproductibilite avec apache 1.3.x
a+
comment:14 Changed 8 years ago by anarcat
christophe, est-ce que tu peux nous fournir ce que l'on te demande: les rewrite rules que tu utilises? Arnaud t'a proposé une solution, et tu n'as pas répondu...
comment:15 Changed 8 years ago by christophe
# .htaccess
RewriteBase? / RewriteRule? toto/([0-9]+)/$ toto.php?id=$1 [L] RewriteRule? toto/([0-9]+)/index.html$ toto.php?id=$1 [L] RewriteRule? toto/([0-9]+).html$ toto.php?nid=$1 [L] RewriteRule? toto/index.html$ toto.php [L] RewriteRule? toto/$ toto.php [L] RewriteRule? toto.html$ toto.php [L]
# toto.php
<?php echo 'id: ' . $_REQUESTid?; ?>
comment:16 Changed 8 years ago by arnaud_lb
C'est la faute à MultiViews?. Cette directive agit comme une RewriteRule? qui ferais:
RewriteRule? (.*)/ $1.php
Et comme ça passe avant le rewrite, on trouve pas toujours du premier coup pourquoi ça marche pas.
Donc renome toto.php en toto_.php par exemple, et ça devrais fonctionner :)
comment:18 Changed 7 years ago by anarcat
- Status changed from assigned to closed
- Resolution set to worksforme
- Milestone 2.0 deleted
virer multiviews et ca marche.
comment:19 Changed 7 years ago by anonymous
free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20 free20
comment:20 Changed 7 years ago by anonymous
boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec boftec
comment:21 Changed 7 years ago by anonymous
3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322 3322
comment:22 Changed 7 years ago by Nicholas
- Summary changed from utilisation du mod_rewrite avec apache to smart+question

Avec ces règles dans un fichier .htaccess:
RewriteEngine? On RewriteRule? test.rw$ test.php
J'ai ça dans les logs:
/var/alternc/dns/t/test.test.com/var/alternc/dns/t/test.test.com/test.php
En fait il suffit d'ajouter un RewriteBase?:
RewriteEngine? On RewriteBase? / RewriteRule? test.rw$ test.php