IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Apache Discussion :

[URL rewriting] Perte des variables (?)


Sujet :

Apache

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre chevronné
    Homme Profil pro
    Webmaster
    Inscrit en
    Janvier 2007
    Messages
    489
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France

    Informations professionnelles :
    Activité : Webmaster
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Janvier 2007
    Messages : 489
    Par défaut [URL rewriting] Perte des variables (?)
    Bonjour à tous,

    J'ai un problème qui concerne visiblement une petite partie de mes visiteurs : le rewriting ne semble pas fonctionner.

    Il doit s'agir visiblement d'une perte des variables car ces même visiteurs sont reconduits en page d'accueil : condition existante sur ma page catalogue par exemple :

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    if(isset($_GET) && isset($_GET["cID"])) { $cID = $_GET['cID']; } else { header('Location: index.php'); }

    Les liens pour accéder à cette page se présentent sous la forme :

    Qui est liée à ma règle rewriting suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^([^/]*)/([^/]*)\.bio$ /catalogue.php?cDisp=$1&cID=$2 [L]
    Mon error_log m'indique ainsi :
    File does not exist: /www/www.monsite.com/prod/hygiene-naturelle-shampoings-bio, referer: http://www.monsite.com/hygiene-natur...o/4_34_0_2.bio
    Pour information mon access_log indique :

    [30/May/2012:09:29:55 +0200] "GET /cosmetique/marques-bio.gif HTTP/1.1" 200 395 "http://www.monsite.com/hygiene-naturelle-shampoings-bio/4_34_0_2.bio" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [30/May/2012:09:29:55 +0200] "GET /images/12888_S.jpg HTTP/1.1" 200 10729 "http://www.monsite.com/hygiene-naturelle-shampoings-bio/4_34_0_2.bio" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [30/May/2012:09:29:55 +0200] "GET /images/12887_S.jpg HTTP/1.1" 200 11272 "http://www.monsite.com/hygiene-naturelle-shampoings-bio/4_34_0_2.bio" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [30/May/2012:09:29:55 +0200] "GET /images/12879_S.jpg HTTP/1.1" 200 17149 "http://www.monsite.com/hygiene-naturelle-shampoings-bio/4_34_0_2.bio" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [30/May/2012:09:29:55 +0200] "GET /images/9059_S.jpg HTTP/1.1" 200 4428 "http://www.monsite.com/hygiene-naturelle-shampoings-bio/4_34_0_2.bio" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    Si quelqu'un avait une idée lumineuse ce serait ma-gni-fique !

    Merci à vous

  2. #2
    Membre chevronné
    Homme Profil pro
    Webmaster
    Inscrit en
    Janvier 2007
    Messages
    489
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France

    Informations professionnelles :
    Activité : Webmaster
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Janvier 2007
    Messages : 489
    Par défaut
    Errata : l'erreur du error_log est liée à la structure de la page visiblement pas au lien.

  3. #3
    Rédacteur
    Avatar de _Mac_
    Profil pro
    Inscrit en
    Août 2005
    Messages
    9 601
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 9 601
    Par défaut
    Est-ce que tu peux donner un extrait d'access_log avec la redirection vers index.php ?

  4. #4
    Membre chevronné
    Homme Profil pro
    Webmaster
    Inscrit en
    Janvier 2007
    Messages
    489
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France

    Informations professionnelles :
    Activité : Webmaster
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Janvier 2007
    Messages : 489
    Par défaut
    Bonjour,

    Merci pour ta réponse.
    Il y a en fait en creusant 2 problèmes qui sont peut être liés.
    Le plus évident est le cas ou j'accède à ma page "sans problème" mais une erreur est quand même générée :

    http://www.monsite.com/hygiene-natur.../4_231_0_2.bio

    Le access_log est le suivant :
    "GET /peigne-et-brosse/4_231_0_2.bio HTTP/1.1" 200 117565 "http://www.monsite.com/hygiene-naturelle-peigne-et-brosse/4_231_0_2.bio" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"
    "GET /peigne-et-brosse/js/scripts.js HTTP/1.1" 404 127570 "http://www.monsite.com/peigne-et-brosse/4_231_0_2.bio" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"
    Et le error_log :
    File does not exist: /www/www.monsite.com/prod/hygiene-naturelle-peigne-et-brosse, referer: http://www.monsite.com/hygiene-natur.../4_231_0_2.bio
    Un grand merci

  5. #5
    Rédacteur
    Avatar de _Mac_
    Profil pro
    Inscrit en
    Août 2005
    Messages
    9 601
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 9 601
    Par défaut
    Bonjour,

    Désolé mais ce n'est pas encore le bon extrait de l'acccess_log : l'extrait que tu donnes parle de ressources ou liens qui sont dans la page qui semble planter. Ce qui m'intéresse c'est d'avoir un extrait de access_log et error_log pour lorsqu'un utilisateur demande /hygiene-naturelle-shampoings-bio/4_34_0_2.bio et est redirigé vers index.php.

  6. #6
    Membre chevronné
    Homme Profil pro
    Webmaster
    Inscrit en
    Janvier 2007
    Messages
    489
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France

    Informations professionnelles :
    Activité : Webmaster
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Janvier 2007
    Messages : 489
    Par défaut
    Voilà donc un exemple :

    [31/May/2012:10:53:28 +0200] "GET /images/7637_S.jpg HTTP/1.1" 200 5297 "http://www.monsite.com/soins-visage-bio-lait-d-anesse/223_0_0_2.bio" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:28 +0200] "GET /images/ane_savon_lavandin_small.jpg HTTP/1.1" 200 11944 "http://www.monsite.com/soins-visage-bio-lait-d-anesse/223_0_0_2.bio" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:28 +0200] "GET /images/ane_savon_orange_small.jpg HTTP/1.1" 200 12306 "http://www.monsite.com/soins-visage-bio-lait-d-anesse/223_0_0_2.bio" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:28 +0200] "GET /images/ane_savon_cedre_small.jpg HTTP/1.1" 200 11974 "http://www.monsite.com/soins-visage-bio-lait-d-anesse/223_0_0_2.bio" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:37 +0200] "GET /catalogue.php?cID=223_0_0_2&order=2&limit=16,16 HTTP/1.1" 200 137366 "http://www.monsite.com/soins-visage-bio-lait-d-anesse/223_0_0_2.bio" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:40 +0200] "GET /images/5099_S.jpg HTTP/1.1" 200 5731 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=16,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:40 +0200] "GET /images/5094_S.jpg HTTP/1.1" 200 8236 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=16,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:40 +0200] "GET /images/5096_S.jpg HTTP/1.1" 200 5991 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=16,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:41 +0200] "GET /images/5214_S.jpg HTTP/1.1" 200 2933 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=16,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:41 +0200] "GET /images/8058_S.jpg HTTP/1.1" 200 6096 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=16,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:47 +0200] "GET /catalogue.php?cID=223_0_0_2&order=2&limit=32,16 HTTP/1.1" 200 138279 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=16,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:50 +0200] "GET /images/12478_S.jpg HTTP/1.1" 200 3087 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=32,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:50 +0200] "GET /images/5843_S.jpg HTTP/1.1" 200 3770 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=32,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:50 +0200] "GET /images/5842_S.jpg HTTP/1.1" 200 4647 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=32,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:50 +0200] "GET /images/5215_S.jpg HTTP/1.1" 200 3048 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=32,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    [31/May/2012:10:53:50 +0200] "GET /images/8450_S.jpg HTTP/1.1" 200 3493 "http://www.monsite.com/catalogue.php?cID=223_0_0_2&order=2&limit=32,16" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; BTRS5841; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)"
    le if(isset($cID)) me renvoie un false...

    [Thu May 31 10:53:24 2012] [error] File does not exist: /www/www.monsite.com/prod/soins-visage-bio-lait-d-anesse, referer: http://www.monsite.com/soins-visage-.../223_0_0_2.bio

  7. #7
    Rédacteur
    Avatar de _Mac_
    Profil pro
    Inscrit en
    Août 2005
    Messages
    9 601
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 9 601
    Par défaut
    Désolé mais ce n'est toujours pas bon. Je cherche un groupe de ligne qui contient quelque chose comme ceci dans access_log :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    "GET /hygiene-naturelle-shampoings-bio/4_34_0_2.bio HTTP/1.1" 301
    et la trace qui correspond (si elle existe) dans error_log.
    Si tu ne peux pas trouver cette ligne ci-dessus dans le fichier access_log c'est qu'en fait il n'y a pas la redirection que tu évoques et qui semble poser problème

  8. #8
    Membre chevronné
    Homme Profil pro
    Webmaster
    Inscrit en
    Janvier 2007
    Messages
    489
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France

    Informations professionnelles :
    Activité : Webmaster
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Janvier 2007
    Messages : 489
    Par défaut
    Merci pour ta réponse.

    Cette redirection est faite avec un header php :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if(isset($cID)) { .... } else { header ("Location: $base_url"); }

Discussions similaires

  1. Réponses: 6
    Dernier message: 21/05/2010, 17h40
  2. règle url rewriting, conservation des variables GET
    Par speedev dans le forum Apache
    Réponses: 1
    Dernier message: 18/05/2009, 10h33
  3. Réponses: 4
    Dernier message: 28/01/2008, 17h55
  4. Réponses: 6
    Dernier message: 19/12/2005, 13h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo