Jump to content

[Résolu]Probleme url rewrite qui fait apparaite un sous dossier accueil dans les pages produit


Recommended Posts

Bonjour,
Depuis quelques jours j'ai un soucis sur le site http://www.safelincs.fr
Avant toutes les urls étaient enregistrées à la racine (ex : http://www.safelincs.fr/111-detecteur-de-monoxyde-de-carbone-kidde-900-0259.html) et la il y a un répertoire accueil qui vient se greffer sur toutes les pages produit (www.safelincs.fr/ accueil/ les pages produits)

Quelqu'un a t il une idée d'ou cela provient?

Version presta : 1.3.2.3

merci

Link to comment
Share on other sites

Oui mais le problème ne vient pas de la j'ai déjà regardé :

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^safelincs.fr$
RewriteRule ^(.*) http://www.safelincs.fr/$1 [QSA,L,R=301]

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

# URL rewriting module activation
#RewriteEngine on

# URL rewriting rules
RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg [L,E]
RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [L,E]
RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$3&isolang;=$1$5 [L,E]
RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang;=$1$4 [L,E]
RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$2&isolang;=$1 [QSA,L,E]
RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L,E]
RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 [QSA,L,E]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]
RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E]

# Catch 404 errors
ErrorDocument 404 /404.php

Link to comment
Share on other sites

Il y a une différence entre "être enregistré dans" et "avoir comme catégorie par défaut" la catégorie accueil
Change la catégorie par défaut d'un produit et vérifie l'url de ce produit.
Je suis quasi certain que le problème vient de là.

Link to comment
Share on other sites

Je viens de regénéré le htaccess :

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^safelincs.fr$
RewriteRule ^(.*) http://www.safelincs.fr/$1 [QSA,L,R=301]

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg [QSA,L,E]
RewriteRule ^([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2.jpg [QSA,L,E]
RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [QSA,L,E]
RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$3&isolang;=$1$5 [QSA,L,E]
RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang;=$1$4 [QSA,L,E]
RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$2&isolang;=$1 [QSA,L,E]
RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [QSA,L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [QSA,L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L,E]
RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 [QSA,L,E]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]
RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E]

# Catch 404 errors
ErrorDocument 404 /404.php

Link to comment
Share on other sites

et oui si je change la catégorie par défaut le nom de la catégorie apparait, ca a toujours fonctionné comme ca de la meme facon que si j'enregistre le produit dans la catégorie accueil, le produit n'avait pas de catégorie tout court...

Link to comment
Share on other sites

As tu fais des modification dans le fichier classes/link.php ? C'est cette classe qui génère les liens produits entres autres.

Voici la fonction en question de mon installation de test

   public function getProductLink($id_product, $alias = NULL, $category = NULL, $ean13 = NULL)
   {
       if (!isset($this->allow)) $this->allow = 0;
       if (is_object($id_product))
           return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite.($id_product->ean13 ? '-'.$id_product->ean13 : '').'.html') :
           (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id));
       elseif ($alias)
           return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias.($ean13 ? '-'.$ean13 : '').'.html') :
           (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product));
       else
           return _PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product);
   }



As tu bien la même chose ?

On voit bien le test "$id_product->category != 'home'"

Link to comment
Share on other sites

Si ta fonction getProductLink est identique à celle postée ci-dessus, vérifie que ta catégorie accueil à bien comme rewrite_name : "home"

Pour vérifier cela, execute la requete suivante :

SELECT `id_category`, `link_rewrite` FROM `ps_category_lang` WHERE `name` = 'Accueil'



Cette requete doit normalement retourner :
id_category = 1
link_rewrite = home

Link to comment
Share on other sites

Aucune modif sur le fichier link mais il est différent :

public function getProductLink($id_product, $alias = NULL, $category = NULL, $ean13 = NULL, $id_lang = NULL)
   {
       if (!isset($this->allow)) $this->allow = 0;
       if (is_object($id_product))
           return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink(intval($id_lang)).(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite.($id_product->ean13 ? '-'.$id_product->ean13 : '').'.html') :
           (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id));
       elseif ($alias)
           return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink(intval($id_lang)).(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias.($ean13 ? '-'.$ean13 : '').'.html') :
           (_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product));
       else
           return _PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product);
   }

Link to comment
Share on other sites

En fait non c'est pas ca mais tu m'a mis sur la piste...
en effet dans la table link_rewrite il y avait une entrée du nom de "accueil" qui n'avait rien à faire la.
je l'ai supprimé et c'est bon.

Merci beaucoup pour cette aide précieuse

Link to comment
Share on other sites

  • 5 months later...

J' un problème avec un sujet commun. Je m'explique :
J'ai fait, en page d'accueil un module, "tout le stock" basé sur le module "homefeatured". Il affiche 7 produits au hasard et le 8e onglet est un lien vers la category "accueil" renommée "tout le stock" (donc category.php?id_category=1). Mais là, il ne m'est affiché aucun produits (alors que la page category.tpl est bien configurée et ne renvoie pas d'erreur sur els autres catégories.)

Y'a t'il un blocage du fait que c'est la catégorie accueil?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...