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 :

RedirectPermanent Url qui a été déja Rewriterule


Sujet :

Apache

  1. #1
    Membre à l'essai
    Inscrit en
    Janvier 2007
    Messages
    35
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 35
    Points : 17
    Points
    17
    Par défaut RedirectPermanent Url qui a été déja Rewriterule
    Bonjour,

    j'ai plusieurs URL qui ont été généré par mon htaccess, de l'URLREWRITING classique pour optimiser l'url pour Google.

    Cependant l'url de la page a changé à cause du dossier (catégorie) du produit

    exemple:
    (Avant) http://monsite.fr/fromage/229-gruyere.html
    fromage c'est la catégorie
    229 c'est l'id du produit
    gruyere c'est le nom produit

    (Maintenant) http://monsite.fr/fromage-francais/229-gruyere.html

    quand je fais dans mon htaccess
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    RedirectPermanent /fromage/229-gruyere.html http://monsite.fr/fromage-francais/229-gruyere.html
    ca ne fonctionne pas.
    Peut-être à cause de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]
    situé plus bas dans mon htaccess.
    l'url d'origine doit être "dynamique" donc peut être que l'on peut pas faire un redirect permanent directement...

    comment arriver au résultat escompté?

  2. #2
    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
    Points : 12 977
    Points
    12 977
    Par défaut
    Il n'y a que ces deux lignes dans ton .htaccess ? On peut l'avoir en entier ?

  3. #3
    Membre à l'essai
    Inscrit en
    Janvier 2007
    Messages
    35
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 35
    Points : 17
    Points
    17
    Par défaut
    Bonjour,

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    <IfModule mod_rewrite.c>
    # URL rewriting module activation
    RewriteEngine on
     
    RedirectPermanent /fr http://www.mondomaine.net
    RedirectPermanent /en http://www.mondomainenet
    RedirectPermanent /2_marque2 http://mondomaine.net
    RedirectPermanent /store.php	http://mondomaine.net/magasins
    RedirectPermanent /promotions	http://mondomaine.net/promotions-bon-plan-destockage-accessoire-moto
    RedirectPermanent /promotions?n=10	http://mondomaine.net/promotions-bon-plan-destockage-accessoire-moto?n=10
    RewriteRule ^api/?(.*)$ /webservice/dispatcher.php?url=$1 [QSA,L]
    RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2$3.jpg [L]
    RewriteRule ^([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2.jpg [L]
    RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg [L]
    RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]
    RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]* /category.php?id_category=$1 [QSA,L]
    RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]
    RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*) /supplier.php?id_supplier=$1 [QSA,L]
    RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*) /manufacturer.php?id_manufacturer=$1 [QSA,L]
    RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms=$1 [QSA,L]
    RewriteRule ^content/category/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms_category=$1 [QSA,L]
    RewriteRule ^page-non-trouvee$ /404.php [QSA,L]
     
    </IfModule>

  4. #4
    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
    Points : 12 977
    Points
    12 977
    Par défaut
    Bonjour,

    Je ne vois pas d'où vient le problème. Quand tu dis que ça ne fonctionne pas, qu'est-ce qu'il se passe exactement ?

    Pour info, j'aurais organisé mon .htaccess de la manière suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    RedirectPermanent /fr http://www.mondomaine.net
    RedirectPermanent /en http://www.mondomainenet
    RedirectPermanent /2_marque2 http://mondomaine.net
    RedirectPermanent /store.php	http://mondomaine.net/magasins
    RedirectPermanent /promotions	http://mondomaine.net/promotions-
     
    <IfModule mod_rewrite.c>
    # URL rewriting module activation
    RewriteEngine on
     
    bon-plan-destockage-accessoire-moto
    RedirectPermanent /promotions?n=10	http://mondomaine.net/promotions-bon-plan-destockage-accessoire-moto?n=10
    RewriteRule ^api/?(.*)$ /webservice/dispatcher.php?url=$1 [QSA,L]
    RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2$3.jpg [L]
    RewriteRule ^([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2.jpg [L]
    RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg [L]
    RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]
    RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]* /category.php?id_category=$1 [QSA,L]
    RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]
    RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*) /supplier.php?id_supplier=$1 [QSA,L]
    RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*) /manufacturer.php?id_manufacturer=$1 [QSA,L]
    RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms=$1 [QSA,L]
    RewriteRule ^content/category/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms_category=$1 [QSA,L]
    RewriteRule ^page-non-trouvee$ /404.php [QSA,L]
     
    </IfModule>

  5. #5
    Membre à l'essai
    Inscrit en
    Janvier 2007
    Messages
    35
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 35
    Points : 17
    Points
    17
    Par défaut
    Citation Envoyé par _Mac_ Voir le message
    Bonjour,

    Je ne vois pas d'où vient le problème. Quand tu dis que ça ne fonctionne pas, qu'est-ce qu'il se passe exactement ?

    Pour info, j'aurais organisé mon .htaccess de la manière suivante :
    ce que j'ai mis plus haut fonctionne certes, mais
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    RedirectPermanent /fromage/229-gruyere.html http://monsite.fr/fromage-francais/229-gruyere.html
    ne fonctionne pas.

    quand je tape sur mon navigateur http://mondomaine.tld//fromage/229-gruyere.html j'ai une erreur 404, je veux donc diriger vers http://monsite.fr/fromage-francais/229-gruyere.html qui est la nouvelle page active.

    comment regler ça

  6. #6
    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
    Points : 12 977
    Points
    12 977
    Par défaut
    Tu mets la directive Redirect pour /fromage/229-gruyere.html à quel endroit du fichier .htaccess ?

  7. #7
    Membre à l'essai
    Inscrit en
    Janvier 2007
    Messages
    35
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 35
    Points : 17
    Points
    17
    Par défaut
    salut mac

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    <IfModule mod_rewrite.c>
    # URL rewriting module activation
    RewriteEngine on
     
    RedirectPermanent /fr http://www.speed-wear.net
    RedirectPermanent /en http://www.speed-wear.net
    RedirectPermanent /0-.html	http://www.speed-wear.net
    RedirectPermanent /1_apple-computer-inc	http://www.speed-wear.net
    RedirectPermanent /1532-pack-vintage-casque-davida-masque-lunette-t2.html http://www.speed-wear.net/66-casques-davida-moto
    RedirectPermanent /2_shure-incorporated	http://speed-wear.net
    RedirectPermanent /store.php	http://speed-wear.net/magasins
    #ici
    RedirectPermanent /alpinestars/1407-alpinestars-apex-drystar.html http://speed-wear.net/1407-alpinestars-apex-drystar.html
    # URL rewriting rules
    RewriteRule ^api/?(.*)$ /webservice/dispatcher.php?url=$1 [QSA,L]
    RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2$3.jpg [L]
    RewriteRule ^([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2.jpg [L]
    RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg [L]
    RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]
    RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]* /category.php?id_category=$1 [QSA,L]
    RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]
    RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*) /supplier.php?id_supplier=$1 [QSA,L]
    RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*) /manufacturer.php?id_manufacturer=$1 [QSA,L]
    </Ifmodule>
    j'ai essaye de la mettre plus bas genre avant le </ifmodule> mais ca ne donne pas l'effet voulu

    merci

  8. #8
    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
    Points : 12 977
    Points
    12 977
    Par défaut
    Et si tu remplaces tes Redirect par mod_rewrite ?

  9. #9
    Membre à l'essai
    Inscrit en
    Janvier 2007
    Messages
    35
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 35
    Points : 17
    Points
    17
    Par défaut
    bonjour,

    je ne comprends pas le mod_rewrite?

    si je fais
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    RedirectPermanent /fromage/229-gruyere.html http://monsite.fr/fromage-francais/229-gruyere.html
    ca me mets une page 404

    si je tape dans le navigateur
    http://monsite.fr/229-gruyere.html
    ca me redirige automatiquement vers http://monsite.fr/fromage-francais/229-gruyere.html

    mais dans google webmaster tools j'ai http://monsite.fr/fromage/229-gruyere.html dans les url introuvable, je veux donc la rediriger vers http://monsite.fr/fromage-francais/229-gruyere.html qui est une url Ok

    c'est quoi le truc ?

  10. #10
    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
    Points : 12 977
    Points
    12 977
    Par défaut
    Citation Envoyé par dztcid Voir le message
    si je tape dans le navigateur
    http://monsite.fr/229-gruyere.html
    ca me redirige automatiquement vers http://monsite.fr/fromage-francais/229-gruyere.html
    Comment c'est possible ? Il n'y a aucune règle RewriteRule ou redirection Redirect qui couvre ce cas.

Discussions similaires

  1. Un URL qui ressemble a un GET alors que c'est un POST
    Par neoncyber dans le forum Langage
    Réponses: 2
    Dernier message: 27/05/2007, 18h20
  2. Récuperation de URL qui se trouve dans la barre d'adresse
    Par MyWork dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 06/04/2007, 11h06
  3. Connaitre l'adresse url qui a appellé une page.
    Par morgan47 dans le forum Langage
    Réponses: 3
    Dernier message: 19/09/2006, 20h07
  4. Passage de paramètres en url qui marche pas
    Par debilemaniac dans le forum Langage
    Réponses: 9
    Dernier message: 30/05/2006, 16h29
  5. Récupérer l'adresse de l'url qui valide le formulaire?
    Par pegase33 dans le forum Général JavaScript
    Réponses: 12
    Dernier message: 26/12/2005, 09h34

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