Url-rewriting et alias apache

P
pewhy
Guest
bonjour,


J'essaie de faire marcher l'url rewriting en local, ca marche dans le repertoire www de apache mais j'arrive pas a le faire marcher si j'utilise un alias

extraits du rewrite.log
>>un exemple qui marche http://localhost/nexistepas.html

Code:
127.0.0.1 - - [13/Sep/2003:05:45:26 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (3) [per-dir c:/program files/easyphp/www/] strip per-dir prefix: c:/program files/easyphp/www/nexistepas.html -> nexistepas.html
127.0.0.1 - - [13/Sep/2003:05:45:26 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (3) [per-dir c:/program files/easyphp/www/] applying pattern '^nexistepas.html$' to uri 'nexistepas.html'
127.0.0.1 - - [13/Sep/2003:05:45:26 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (2) [per-dir c:/program files/easyphp/www/] rewrite nexistepas.html -> index.php
127.0.0.1 - - [13/Sep/2003:05:45:26 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (3) [per-dir c:/program files/easyphp/www/] add per-dir prefix: index.php -> c:/program files/easyphp/www/index.php
127.0.0.1 - - [13/Sep/2003:05:45:26 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (2) [per-dir c:/program files/easyphp/www/] strip document_root prefix: c:/program files/easyphp/www/index.php -> /index.php
127.0.0.1 - - [13/Sep/2003:05:45:26 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (1) [per-dir c:/program files/easyphp/www/] internal redirect with /index.php [INTERNAL REDIRECT]
127.0.0.1 - - [13/Sep/2003:05:45:26 +0200] [localhost/sid#5c5808][rid#7f0588/initial/redir#1] (3) [per-dir c:/program files/easyphp/www/] strip per-dir prefix: c:/program files/easyphp/www/index.php -> index.php
127.0.0.1 - - [13/Sep/2003:05:45:26 +0200] [localhost/sid#5c5808][rid#7f0588/initial/redir#1] (3) [per-dir c:/program files/easyphp/www/] applying pattern '^nexistepas.html$' to uri 'index.php'
127.0.0.1 - - [13/Sep/2003:05:45:26 +0200] [localhost/sid#5c5808][rid#7f0588/initial/redir#1] (1) [per-dir c:/program files/easyphp/www/] pass through c:/program files/easyphp/www/index.php

>> une exemple qui marche pas http://localhost/lpqv/nexistepas.html
Code:
127.0.0.1 - - [13/Sep/2003:05:59:00 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (3) [per-dir d:/_projets_/lapierrequivole.com/www/] strip per-dir prefix: d:/_projets_/lapierrequivole.com/www/nexistepas.html -> nexistepas.html
127.0.0.1 - - [13/Sep/2003:05:59:00 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (3) [per-dir d:/_projets_/lapierrequivole.com/www/] applying pattern '^nexistepas.html$' to uri 'nexistepas.html'
127.0.0.1 - - [13/Sep/2003:05:59:00 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (2) [per-dir d:/_projets_/lapierrequivole.com/www/] rewrite nexistepas.html -> index.php
127.0.0.1 - - [13/Sep/2003:05:59:00 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (3) [per-dir d:/_projets_/lapierrequivole.com/www/] add per-dir prefix: index.php -> d:/_projets_/lapierrequivole.com/www/index.php
127.0.0.1 - - [13/Sep/2003:05:59:00 +0200] [localhost/sid#5c5808][rid#7eee10/initial] (1) [per-dir d:/_projets_/lapierrequivole.com/www/] internal redirect with d:/_projets_/lapierrequivole.com/www/index.php [INTERNAL REDIRECT]
dans ce cas j'ai droit a ce message de le error.log de apache
Code:
[Sat Sep 13 05:59:00 2003] [error] [client 127.0.0.1] Invalid URI in request GET /lpqv/nexistepas.html HTTP/1.1


Si il y avait une bonne ame pour venir a mon secours je lui dresserais une statue, sinon je me debrouillerais pour ne pas utiliser les alias, qui sont pourtant bien pratiques...

Pierre
 
Nouveau WRInaute
url rewriting alias apache

Bonjour,

Apparement j'ai le problème que tu as eu il y a quelques mois. Je t'écris pour te demander si tu as réussi à trouver la solution pour le rewriting avec les alias.

Merci de ton aide.

Philippe.
 
WRInaute occasionnel
Ca dépend un peu de la conf utilisée, mais en général pour pouvoir réécrire une URL vers un alias, il faut utiliser le flag PT, pour indiquer que d'autres traitements doivent intervenir sur l'URL. Par exemple,
Code:
RewriteRule /lpqv/nexistepas.html /lpqv/existe.html  [PT,L]
 
Nouveau WRInaute
rewrting alias apache

je ne comprend pas pkoi il faut faire ça, puisque le fichier htaccess se trouve dans le répertoire de l'alias, et que l'adresse tapé dans l'url contien aussi l'alias?

Peux tu m'éclairer?

Merci
 
WRInaute occasionnel
Je cite (doc URL rewrite)

'passthrough|PT' (pass through to next handler)
This flag forces the rewriting engine to set the uri field of the internal request_rec structure to the value of the filename field. This flag is just a hack to be able to post-process the output of RewriteRule directives by Alias, ScriptAlias, Redirect, etc. directives from other URI-to-filename translators
 
Discussions similaires
Haut