Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Serveurs (Apache, IIS,...) > Apache
Apache Forum d'entraide Apache. Avant de poster : Cours Apache, FAQ Apache
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 19/02/2011, 18h10   #1
Futur Membre du Club
 
83pulse@gmail.com 83pulse@gmail.com
Inscription : février 2011
Messages : 33
Détails du profil
Informations personnelles :
Nom : 83pulse@gmail.com 83pulse@gmail.com

Informations forums :
Inscription : février 2011
Messages : 33
Points : 17
Points : 17
Par défaut Url rewriting et dossiers virtuels

Bonjour à tous,

Ca fait 2heures que je tourne en rond sur mon .htaccess et dans tout ce que j'ai pu trouver, rien n'y fait ... Le problème est simple, dans mon fichier, j'ai ça :

Code :
1
2
3
RewriteEngine on 
RewriteBase / 
RewriteRule ^([a-z]+/)?([0-9a-zA-Z-]+)$ /index.php?id=$1&usr=$2 [L,NC]]
exemple d'url : http://127.0.0.1/validation/3k8mklf113dklq29wn3iokld
pour ma page : http://127.0.0.1/index.php?id=valida...dklq29wn3iokld

Tout ce passe correctement sur le navigateur (!) mais dans le log apache j'ai ça :

Code :
[Sat Feb 19 17:36:28 2011] [error] [client 127.0.0.1] File does not exist: I:/Web/validation, referer: http://127.0.0.1/validation/3k8mklf113dklq29wn3iokld
Vous n'auriez pas une petite idée?

Merci d'avance!
kfa1983 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/02/2011, 18h20   #2
Rédacteur/Modérateur
 
Avatar de _Mac_
 
Inscription : août 2005
Messages : 8 278
Détails du profil
Informations forums :
Inscription : août 2005
Messages : 8 278
Points : 8 565
Points : 8 565
Difficile de dire où est le problème. Vue la trace d'erreur, le code HTML de http://127.0.0.1/validation/3k8mklf113dklq29wn3iokld contient une URL qu'Apache interprète (après ou sans réécriture, je ne sais pas) comme pointant sur la ressource système I:/Web/validation qui n'existe visiblement pas. A la limite, active les logs de mod_rewrite pour voir si le problème vient de la réécriture, mais il faut aussi examiner le code HTML de la page.
__________________

Du détail, du détail, du détail !!!
Revenons à la source : lisons la documentation et les fichiers de trace, la réponse à notre problème s'y trouve sans doute
_Mac_ est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 19/02/2011, 18h33   #3
Futur Membre du Club
 
83pulse@gmail.com 83pulse@gmail.com
Inscription : février 2011
Messages : 33
Détails du profil
Informations personnelles :
Nom : 83pulse@gmail.com 83pulse@gmail.com

Informations forums :
Inscription : février 2011
Messages : 33
Points : 17
Points : 17
Whaou!

Merci pour la rapidité et la pertinence de ton intervention Je ne savais pas qu'il y avait des logs pour le mod rewrite, je vais voir ça alors... Sinon, effectivement le problème c'est que l'url est "virtuelle" et que par définition, l'arborescence n'existe pas. Mon code html est correct mais il me semble que ce qui se passe en fait, est que pour les images, par exemple, au lieu de suivre le css de l'index.php, Apache va changer le document_root de /web/gfx/ à /web/validation/gfx qui n'existe pas, tu me suis?

En gros, le système est tel que le dossier root se présent comme suit :

index.php (fichier)
.htaccess (fichier
gfx/ (dossier image)
inc/ (dossier includes)
cnt/ (dossier de contenu)

[...]

Dans index.php, un include s'effectue selon la variable "id" qui injecte la page demandée par l'utilisateur (en l'occurence "validation" qui se trouve dans le dossier cnt/validation.php), et à partir de cette include, l'url rewrite me pose problème car il va chercher de l'information (images, includes) là où n'existe pas.

Enfin bref, dans un premier temps, je vais controler mes logs! Encore merci, je reviendrai poster plus tard xD
kfa1983 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/02/2011, 18h40   #4
Futur Membre du Club
 
83pulse@gmail.com 83pulse@gmail.com
Inscription : février 2011
Messages : 33
Détails du profil
Informations personnelles :
Nom : 83pulse@gmail.com 83pulse@gmail.com

Informations forums :
Inscription : février 2011
Messages : 33
Points : 17
Points : 17
Ah oui! J'oubliais, pour être sûr que le problème ne vienne pas de l'html, dans mon index.php j'ai ajouter la ligne:

$proper_id = str_replace('/', '', trim($_GET['id']));

afin d'avoir un id pur texte!
kfa1983 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/02/2011, 18h53   #5
Futur Membre du Club
 
83pulse@gmail.com 83pulse@gmail.com
Inscription : février 2011
Messages : 33
Détails du profil
Informations personnelles :
Nom : 83pulse@gmail.com 83pulse@gmail.com

Informations forums :
Inscription : février 2011
Messages : 33
Points : 17
Points : 17
Voilà le log rewrite en level 9, en warn, il n'affichait rien, je suppose qu'on peut descendre jusqu'à la ligne //le dossier saute! car c'est à partir de là qu'il cherche un dossier qui n'existe pas!

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (3) [perdir I:/Web/] add path info postfix: I:/Web/confirm -> I:/Web/confirm/26399a42a0511380c1cb111546baf0ca
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (3) [perdir I:/Web/] strip per-dir prefix: I:/Web/confirm/26399a42a0511380c1cb111546baf0ca -> confirm/26399a42a0511380c1cb111546baf0ca
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (3) [perdir I:/Web/] applying pattern '.*\.(png|swf|flv|mp3|mp4|jpe?g)$' to uri 'confirm/26399a42a0511380c1cb111546baf0ca'
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (3) [perdir I:/Web/] add path info postfix: I:/Web/confirm -> I:/Web/confirm/26399a42a0511380c1cb111546baf0ca
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (3) [perdir I:/Web/] strip per-dir prefix: I:/Web/confirm/26399a42a0511380c1cb111546baf0ca -> confirm/26399a42a0511380c1cb111546baf0ca
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (3) [perdir I:/Web/] applying pattern '^([a-z]+/)?([0-9a-zA-Z-]+)$' to uri 'confirm/26399a42a0511380c1cb111546baf0ca'
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (4) [perdir I:/Web/] RewriteCond: input='/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^/inc' => matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (4) [perdir I:/Web/] RewriteCond: input='/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^/inc/js' => matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (4) [perdir I:/Web/] RewriteCond: input='/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^/inc/lang' => matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (4) [perdir I:/Web/] RewriteCond: input='/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^/inc/pma' => matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (4) [perdir I:/Web/] RewriteCond: input='/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^/gfx' => matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (4) [perdir I:/Web/] RewriteCond: input='/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^/cnt' => matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (4) [perdir I:/Web/] RewriteCond: input='/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^/pma' => matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (4) [perdir I:/Web/] RewriteCond: input='/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^/usr' => matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (4) [perdir I:/Web/] RewriteCond: input='/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^/usr/pics' => matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (4) [perdir I:/Web/] RewriteCond: input='/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^/usr/vids' => matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (2) [perdir I:/Web/] rewrite 'confirm/26399a42a0511380c1cb111546baf0ca' -> '/index.php?id=confirm/&usr=26399a42a0511380c1cb111546baf0ca'
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (3) split uri=/index.php?id=confirm/&usr=26399a42a0511380c1cb111546baf0ca -> uri=/index.php, args=id=confirm/&usr=26399a42a0511380c1cb111546baf0ca
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (2) [perdir I:/Web/] trying to replace prefix I:/Web/ with /
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#319f448/initial] (1) [perdir I:/Web/] internal redirect with /index.php [INTERNAL REDIRECT]
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#31991f8/initial/redir#1] (3) [perdir I:/Web/] strip per-dir prefix: I:/Web/index.php -> index.php
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#31991f8/initial/redir#1] (3) [perdir I:/Web/] applying pattern '.*\.(png|swf|flv|mp3|mp4|jpe?g)$' to uri 'index.php'
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#31991f8/initial/redir#1] (3) [perdir I:/Web/] strip per-dir prefix: I:/Web/index.php -> index.php
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#31991f8/initial/redir#1] (3) [perdir I:/Web/] applying pattern '^([a-z]+/)?([0-9a-zA-Z-]+)$' to uri 'index.php'
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#31991f8/initial/redir#1] (3) [perdir I:/Web/] strip per-dir prefix: I:/Web/index.php -> index.php
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#31991f8/initial/redir#1] (3) [perdir I:/Web/] applying pattern '^([0-9a-zA-Z-]+)$' to uri 'index.php'
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#31991f8/initial/redir#1] (1) [perdir I:/Web/] pass through I:/Web/index.php
// le dossier saute!
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (3) [perdir I:/Web/] add path info postfix: I:/Web/confirm -> I:/Web/confirm/gfx/w.png
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (3) [perdir I:/Web/] strip per-dir prefix: I:/Web/confirm/gfx/w.png -> confirm/gfx/w.png
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (3) [perdir I:/Web/] applying pattern '.*\.(png|swf|flv|mp3|mp4|jpe?g)$' to uri 'confirm/gfx/w.png'
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (4) [perdir I:/Web/] RewriteCond: input='http://127.0.0.1/confirm/26399a42a0511380c1cb111546baf0ca' pattern='!^http://127.0.0.1/.*$' [NC] => not-matched
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (3) [perdir I:/Web/] add path info postfix: I:/Web/confirm -> I:/Web/confirm/gfx/w.png
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (3) [perdir I:/Web/] strip per-dir prefix: I:/Web/confirm/gfx/w.png -> confirm/gfx/w.png
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (3) [perdir I:/Web/] applying pattern '^([a-z]+/)?([0-9a-zA-Z-]+)$' to uri 'confirm/gfx/w.png'
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (3) [perdir I:/Web/] add path info postfix: I:/Web/confirm -> I:/Web/confirm/gfx/w.png
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (3) [perdir I:/Web/] strip per-dir prefix: I:/Web/confirm/gfx/w.png -> confirm/gfx/w.png
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (3) [perdir I:/Web/] applying pattern '^([0-9a-zA-Z-]+)$' to uri 'confirm/gfx/w.png'
127.0.0.1 - - [19/Feb/2011:18:47:57 +0100] [127.0.0.1/sid#1515150][rid#30aa300/initial] (1) [perdir I:/Web/] pass through I:/Web/confirm
C'est quoi le prob avec le postfix?
kfa1983 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/02/2011, 19h08   #6
Futur Membre du Club
 
83pulse@gmail.com 83pulse@gmail.com
Inscription : février 2011
Messages : 33
Détails du profil
Informations personnelles :
Nom : 83pulse@gmail.com 83pulse@gmail.com

Informations forums :
Inscription : février 2011
Messages : 33
Points : 17
Points : 17
Tout compte fait, le .css est correct... Mais les images en pur html <img src="gfx/w.png"> ne s'affichent pas (désolé mais ce sont des images cachées au chargement de la page donc je ne les avais pas vu!)... Bizarre... Je vais voir ça.

Edit: effectivement... j'ai toutes mes adresses en url absolues et j'ai mis du relatif pour 3 images lol... d'où le problème! Merci pour ton intervention mac! J'ai pu cibler le souci grace aux logs
kfa1983 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 09h29.


 
 
 
 
Partenaires

Hébergement Web