Erreur lors d'une redirection Apache
Raoul555
Messages postés
9
Date d'inscription
Statut
Membre
Dernière intervention
-
boly38 Messages postés 267 Date d'inscription Statut Membre Dernière intervention -
boly38 Messages postés 267 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Je souhaite faire une redirection au niveau de mon serveur Apache pour proposer un contenu propre au mobile.
Ma redirection commence bien : Apache transforme comme je veux l'url '/~simon/tests/omega' en '/~simon/tests/omega/m'.
Par contre, à l'étape suivante, il transforme l'url '/~simon/tests/omega/m' en fichier local '/Users/simon/tests/omega/m' ce qui entraîne une erreur.
En effet, mon Apache tourne sur un Mac, et l'url '/~simon/tests/omega/m' devrait correspondre au fichier '/Users/simon/Sites/tests/omega/m'.
Qu'est-ce qui cloche à votre avis?
Pour info, extrait du httpd.conf :
---
RewriteEngine on
#redirect mobile browser using HTTP_ACCEPT header
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC]
RewriteCond %{HTTP_HOST} "!/tests/omega/m" [NC]
RewriteRule (.*)/tests/omega(.*) $1/tests/omega/m$2 [L]
#some high-end phone sometimes support HTML, only its sucks
#add more browser user agent sig here
RewriteCond %{HTTP_USER_AGENT} (nokia|symbian|iphone|blackberry) [NC]
RewriteCond %{HTTP_HOST} "!/tests/omega/m" [NC]
RewriteRule (.*)/tests/omega(.*) $1/tests/omega/m$2 [L]
---
Et les logs d'Apache :
---
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (2) init rewrite engine with requested uri /~simon/tests/omega
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (3) applying pattern '(.*)/tests/omega(.*)' to uri '/~simon/tests/omega'
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (4) RewriteCond: input='application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5' pattern='text/vnd.wap.wml|application/vnd.wap.xhtml+xml' [NC] => not-matched
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (3) applying pattern '(.*)/tests/omega(.*)' to uri '/~simon/tests/omega'
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (4) RewriteCond: input='Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_5 like Mac OS X; fr-fr) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5' pattern='(nokia|symbian|iphone|blackberry)' [NC] => matched
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (4) RewriteCond: input='ww.xx.yy.zz' pattern='!/tests/omega/m' [NC] => matched
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (2) rewrite '/~simon/tests/omega' -> '/~simon/tests/omega/m'
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (2) local path result: /Users/simon/tests/omega/m
---
Raoul
Je souhaite faire une redirection au niveau de mon serveur Apache pour proposer un contenu propre au mobile.
Ma redirection commence bien : Apache transforme comme je veux l'url '/~simon/tests/omega' en '/~simon/tests/omega/m'.
Par contre, à l'étape suivante, il transforme l'url '/~simon/tests/omega/m' en fichier local '/Users/simon/tests/omega/m' ce qui entraîne une erreur.
En effet, mon Apache tourne sur un Mac, et l'url '/~simon/tests/omega/m' devrait correspondre au fichier '/Users/simon/Sites/tests/omega/m'.
Qu'est-ce qui cloche à votre avis?
Pour info, extrait du httpd.conf :
---
RewriteEngine on
#redirect mobile browser using HTTP_ACCEPT header
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC]
RewriteCond %{HTTP_HOST} "!/tests/omega/m" [NC]
RewriteRule (.*)/tests/omega(.*) $1/tests/omega/m$2 [L]
#some high-end phone sometimes support HTML, only its sucks
#add more browser user agent sig here
RewriteCond %{HTTP_USER_AGENT} (nokia|symbian|iphone|blackberry) [NC]
RewriteCond %{HTTP_HOST} "!/tests/omega/m" [NC]
RewriteRule (.*)/tests/omega(.*) $1/tests/omega/m$2 [L]
---
Et les logs d'Apache :
---
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (2) init rewrite engine with requested uri /~simon/tests/omega
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (3) applying pattern '(.*)/tests/omega(.*)' to uri '/~simon/tests/omega'
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (4) RewriteCond: input='application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5' pattern='text/vnd.wap.wml|application/vnd.wap.xhtml+xml' [NC] => not-matched
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (3) applying pattern '(.*)/tests/omega(.*)' to uri '/~simon/tests/omega'
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (4) RewriteCond: input='Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_5 like Mac OS X; fr-fr) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5' pattern='(nokia|symbian|iphone|blackberry)' [NC] => matched
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (4) RewriteCond: input='ww.xx.yy.zz' pattern='!/tests/omega/m' [NC] => matched
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (2) rewrite '/~simon/tests/omega' -> '/~simon/tests/omega/m'
ww.xx.yy.zz - - [25/Aug/2011:00:01:57 +0200] [ww.xx.yy.zz/sid#7f8ea1020b08][rid#7f8ea11768a0/initial] (2) local path result: /Users/simon/tests/omega/m
---
Raoul
A voir également:
- Erreur lors d'une redirection Apache
- Apache open office gratuit - Télécharger - Suite bureautique
- Erreur t32 ✓ - Forum Livebox
- Instagram une erreur s'est produite - Forum Instagram
- Erreur 0x80070643 - Accueil - Windows
- Erreur 4101 france tv - Forum Lecteurs et supports vidéo
2 réponses
Bonjour, je ne connais pas trop Mac, mais j'ai du mal à comprendre ceci :
>En effet, mon Apache tourne sur un Mac, et l'url '/~simon/tests/omega/m' devrait correspondre au fichier '/Users/simon/Sites/tests/omega/m'.
pourquoi /Sites est-il ajouté ?
>En effet, mon Apache tourne sur un Mac, et l'url '/~simon/tests/omega/m' devrait correspondre au fichier '/Users/simon/Sites/tests/omega/m'.
pourquoi /Sites est-il ajouté ?
Ben sous Mac, c'est comme cela : le site de l'utilisateur ~simon est stocké dans le répertoire /Users/simon/Sites:
Ordinateur-de-Simon:users root# cat simon.conf
<Directory "/Users/simon/Sites/">
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Ainsi http://WW.XX.YY.ZZ/~simon/index.html affiche dans le navigateur le fichier /Users/simon/Sites/index.html
Cela marche très bien lorsque RewriteEngine est à off.
Ordinateur-de-Simon:users root# cat simon.conf
<Directory "/Users/simon/Sites/">
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Ainsi http://WW.XX.YY.ZZ/~simon/index.html affiche dans le navigateur le fichier /Users/simon/Sites/index.html
Cela marche très bien lorsque RewriteEngine est à off.
(sans grande conviction) et en ajoutant
après le
(même si je sais qu'ici il n'y a pas de lien symbolique... src )
Options +FollowSymLinks
après le
RewriteEngine On
(même si je sais qu'ici il n'y a pas de lien symbolique... src )