Ticket #426 (closed defect: worksforme)

Opened 4 years ago

Last modified 2 years ago

smart+question

Reported by: christophe Assigned to: 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

04/22/05 01:33:45 changed by arnaud_lb

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

04/23/05 18:27:30 changed 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

04/28/05 20:28:39 changed by christophe

en clair index = index.php

/contact = parametre 1 ($1)

/info.htm = parametre 2 ($2)

04/29/05 13:31:41 changed by christophe

alors j aimerais avoir une solution qui tourne impecable

05/02/05 19:06:34 changed 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

05/02/05 20:07:51 changed 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

05/02/05 20:15:59 changed 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.

05/02/05 22:12:01 changed 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 )

05/03/05 09:53:27 changed 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

05/03/05 16:41:13 changed 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...

05/09/05 20:11:27 changed by christophe

salut anarcat

non pour moi c est pas resolue

les deux ensemble ne fonctionnent pas a present

donc que faire ?

05/09/05 20:18:10 changed by arnaud_lb

Tu as quoi exactement comme RewriteRule? ? Tu obtient quoi comme erreur ? le fichier de logs dit quoi ?

05/10/05 19:45:24 changed 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+

05/10/05 19:47:42 changed 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...

05/10/05 19:51:04 changed 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?; ?>

05/10/05 20:18:09 changed 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 :)

02/24/06 07:42:21 changed by anarcat

  • type set to defect.
  • milestone changed from 0.9.3 to 2.0.

08/28/06 18:14:51 changed by anarcat

  • status changed from assigned to closed.
  • resolution set to worksforme.
  • milestone deleted.

virer multiviews et ca marche.

09/08/06 16:35:04 changed 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