Jump to content

URL Rewriting ne fonctionne pas


Recommended Posts

Bonjour,

Je suis en train de cree ma boutique prestashop et je ne comprends pas car j'ai bien suivi toutes les instructions et le site marche très bien mais pas l'url rewriting.

J'ai renommé le fichier en .htaccess et j'ai ajouté les modifs pour mon hebergement OVH plan90 comme çà:

SetEnv PHP_VER 5
SetEnv REGISTER_GLOBALS 0
# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
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]

# Catch 404 errors
ErrorDocument 404 /404.php


Quelqu'un peut me dire comment faire marcher l'URL Rewriting???

Link to comment
Share on other sites

Comme dit plus haut je pense aussi que c'est l'instruction RewriteBase qui doit être mal configuré.
Vérifie bien le chemin de ta boutique sur ton serveur.

Voici mon .htaccess sur un serveur OVH, si ça peu aider.

SetEnv PHP_VER 5
SetEnv REGISTER_GLOBALS 0

# URL rewriting module activation
RewriteEngine on
RewriteBase /prestashop

# URL rewriting rules
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]

# Catch 404 errors
ErrorDocument 404 /404.php

Link to comment
Share on other sites

  • 2 weeks later...

Le problème vient probablement du drapeau "E".

Essaye avec le fichier suivant:

# URL rewriting module activation
RewriteEngine on
RewriteBase / 

# URL rewriting rules
RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$2$4 [L]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L]
RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L]

# Catch 404 errors
ErrorDocument 404 /404.php



Chez moi ça a résolu le problème :)

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

Bonjour,
Je viens de passer à la version 1.3 et j'essaie de mettre en place la réecriture, mais à chaque fois que je crée une règle, je n'ai plus rien dans la configuration de ce module.

Je suis obligée de le désinstaller et le réinstaller pour voir à nouveau apparaître les champs de la configuration.

Merci pour votre aide

Link to comment
Share on other sites

  • 9 months later...

Bonjour une bête question, qui peut m'expliquer la définition de réécriture et comment sait-on qu'il fonctionne.
J'ai suivi la config. Prestashop m'a créé mon htaccess mais j'ai un doute sur son fonctionnement car mon erreur 404 ne pointe pas vers mon fichier 404.php.

Voici le contenu de mon HTACCESS (chmod 777)

AddType x-mapp-php5 .php

# URL rewriting module activation
RewriteEngine on
RewriteBase /MON SITE PRESTASHOP/

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

# Catch 404 errors
ErrorDocument 404 /MON SITE PRESTASHOP/404.php


merci pour vos réponse. (je suis chez PHPNET)

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...