Jump to content

Problème de redirections 301


Recommended Posts

Bonsoir,

 

sur un presta 1.6 j'ai de grandes difficultés avec des redir 301.

 

exemples :

 

1. problèmes de slash

la règle RedirectPermanent /company-en    https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer

mène bien l'url http://www.oeliatec.com/company-en

vers https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer

MAIS, elle mène http://www.oeliatec.com/company-en/

vers https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer/

qui est une erreur 404....

Je tente donc d'ajouter RedirectPermanent /company-en    https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer mais cela ne fonctionne pas, toujours un / à la fin, et ce n'est pas la solution car je vais alors avoir un .htacces de la taille d'un dictionnaire.

 

2. url qui donne n'importe quoi

http://www.oeliatec.com/company-en/img_0807-2-3/

doit rediriger vers https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer

mais à la place cela m'amène vers https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer/img_0807-2-3/

règle : RedirectPermanent /company-en/img_0807-2-3/    https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer

Ici encore c'est à devenir dingue !

 

Merci d'avance pour votre aide...

Edited by dkbane (see edit history)
Link to comment
Share on other sites

Bien vu, voici un extrait :

 

(J'ai testé ta proposition mais cela ne fonctionne pas - je ne comprends vraiment pas ce qui se passe... c'est peut-être les urls réécrites mais je me vois mal désactiver cette option !)

RewriteEngine on


# Redir 301 allemand
RedirectPermanent /de    https://www.oeliatec.de
RedirectPermanent /eolia-hiver-de    https://www.oeliatec.de
RedirectPermanent /eolia-lav-de    https://www.oeliatec.de
RedirectPermanent /firma/img_0816-2-2/    https://www.oeliatec.de/content/4-okologische-Unkrautbekampfungsmaschine-Hersteller
RedirectPermanent /firma/img_0817-2-2/    https://www.oeliatec.de/content/4-okologische-Unkrautbekampfungsmaschine-Hersteller

# Redir 301 espagnol
RedirectPermanent /politica-de-cookies    https://www.oeliatec.es
RedirectPermanent /es    https://www.oeliatec.es
RedirectPermanent /la-empresa-oeliatec/img_0823-2-6/    https://www.oeliatec.es/content/4-fabricante-deshidratadoras-ecologicas
RedirectPermanent /la-empresa-oeliatec/img_0851-2-5/    https://www.oeliatec.es/content/4-fabricante-deshidratadoras-ecologicas


# Redir 301 anglais
RedirectPermanent /slide-view/professional-equipment    https://www.oeliatec.com
RedirectPermanent /category/uncategorized    https://www.oeliatec.com
RedirectPermanent /en    https://www.oeliatec.com
RedirectPermanent /company-en/img_0814-2-3/    https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer
RedirectPermanent /company-en/img_0816-2-3/    https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer


# 301 fr

RedirectPermanent /wp-content/uploads/2014/09/plaquette-Brehat.pdf    https://www.oeliatec.fr
RedirectPermanent /societe/img_0807-2/    https://www.oeliatec.fr/content/4-fabricant-desherbeuses-ecologiques
RedirectPermanent /principe-de-desherbage    https://www.oeliatec.fr/content/6-principe-desherbage-sans-pesticides
RedirectPermanent /principe-de-desherbage/attachment/9/    https://www.oeliatec.fr/content/6-principe-desherbage-sans-pesticides

RedirectPermanent /salon-vert    https://www.oeliatec.fr/news/salons/oeliatec-salons-europeens-2017-

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on


# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^www.oeliatec.test$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.test$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]


#Domain: www.oeliatec.de
RewriteCond %{HTTP_HOST} ^www.oeliatec.de$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^www.oeliatec.de$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.de$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.de$
blablabla
RewriteCond %{HTTP_HOST} ^www.oeliatec.de$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %{HTTP_HOST} ^www.oeliatec.de$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^www.oeliatec.de$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.de$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]


#Domain: www.oeliatec.es
RewriteCond %{HTTP_HOST} ^www.oeliatec.es$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^www.oeliatec.es$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.es$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.es$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
blablabla
# AlphaImageLoader for IE and fancybox
RewriteCond %{HTTP_HOST} ^www.oeliatec.es$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^www.oeliatec.es$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.es$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]


#Domain: www.oeliatec.fr
RewriteCond %{HTTP_HOST} ^www.oeliatec.fr$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^www.oeliatec.fr$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.fr$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.fr$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
blablabla
RewriteCond %{HTTP_HOST} ^www.oeliatec.fr$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^www.oeliatec.fr$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.fr$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]


#Domain: www.oeliatec.com
RewriteCond %{HTTP_HOST} ^www.oeliatec.com$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^www.oeliatec.com$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.com$
blablabla
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.com$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %{HTTP_HOST} ^www.oeliatec.com$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^www.oeliatec.com$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^www.oeliatec.com$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
<IfModule mod_headers.c>
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|svg)$">
        Header add Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

# Sans www
RewriteCond %{HTTP_HOST} ^oeliatec.fr$
RewriteRule ^(.*)$ https://www.oeliatec.fr/$1 [QSA,L,R=301]
RewriteCond %{HTTP_HOST} ^oeliatec.de$
RewriteRule ^(.*)$ https://www.oeliatec.de/$1 [QSA,L,R=301]
RewriteCond %{HTTP_HOST} ^oeliatec.es$
RewriteRule ^(.*)$ https://www.oeliatec.es/$1 [QSA,L,R=301]
Edited by dkbane (see edit history)
Link to comment
Share on other sites

Ma règle ne fonctionne pas ?!?

 

Remplaces ces 2 lignes:

RedirectPermanent /company-en/img_0814-2-3/    https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer
RedirectPermanent /company-en/img_0816-2-3/    https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer

Par celle-ci

RewriteRule ^company-en/img_0814-2-3/?$    https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer [R=301,L]

Si j'ai correctement compris ton besoin ça doit marcher, autrement dit, si quelqu'un arrive avec https://www.oeliatec.com/company-en/img_0814-2-3 ou https://www.oeliatec.com/company-en/img_0814-2-3/ il va être redirigé vers https://www.oeliatec.com/content/4-ecological-weeding-machines-manufacturer

Edited by doekia (see edit history)
Link to comment
Share on other sites

Cela résout bien mon problème numéro 2 (merci !!!) il reste maintenant le 1 =)

 

Pour rappel :

 

1. problèmes de slash

la règle RedirectPermanent /company-en    https://www.oeliatec...es-manufacturer

mène bien l'url http://www.oeliatec.com/company-en

vers https://www.oeliatec...es-manufacturer

MAIS, elle mène http://www.oeliatec.com/company-en/

vers https://www.oeliatec...s-manufacturer/

qui est une erreur 404....

Je tente donc d'ajouter RedirectPermanent /company-en    https://www.oeliatec...es-manufacturer mais cela ne fonctionne pas, toujours un / à la fin, et ce n'est pas la solution car je vais alors avoir un .htacces de la taille d'un dictionnaire.

2. (résolu): url qui donne n'importe quoi
http://www.oeliatec....n/img_0807-2-3/
doit rediriger vers https://www.oeliatec...es-manufacturer
mais à la place cela m'amène vers https://www.oeliatec...r/img_0807-2-3/
règle : RedirectPermanent /company-en/img_0807-2-3/    https://www.oeliatec...es-manufacturer
Ici encore c'est à devenir dingue !
Edited by dkbane (see edit history)
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...