Jump to content

Problème redirection 301 (petite panique)


Recommended Posts

Bonjour,

Version de PS : 1.7.5.1
URL du site concerné : https://raccords-tubes-centurion.fr/
Thème (défaut/perso) : theme enfant du theme par défaut
Hébergement : o2switch
Version de PHP : 7.2.16
Version de MySQL : 10.2.22-MariaDB-cll-lve

Bonjour à tous,

J'ai migré mon site de Joomla à prestashop hier et je m’aperçois que mes redirections 301 ne fonctionne pas. Je vous laisse mon fichier .htaccess

# ~~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

#redirection ancien site
redirect 301 /achat-centurion https://raccords-tubes-centurion.fr/
redirect 301 /achat-centurion/garde-crops-aluminium-industriels https://raccords-tubes-centurion.fr/centurion/8-garde-corps-industriel
redirect 301 /achat-centurion/raccords-carres https://raccords-tubes-centurion.fr/15-raccord-tubulaire-carre
redirect 301 /achat-centurion/raccords-carres/20x20 https://raccords-tubes-centurion.fr/16-raccord-tubulaire-carre-20x20mm
redirect 301 /achat-centurion/raccords-carres/25x25 https://raccords-tubes-centurion.fr/17-raccord-tubulaire-carre-25x25mm
redirect 301 /achat-centurion/raccords-ronds https://raccords-tubes-centurion.fr/4-raccord-tubulaire-ronds
redirect 301 /achat-centurion/raccords-ronds/diametre-27mm https://raccords-tubes-centurion.fr/6-raccord-tubulaire-diametre-27mm
redirect 301 /achat-centurion/raccords-ronds/diametre-30mm https://raccords-tubes-centurion.fr/7-raccord-tubulaire-diametre-30mm
redirect 301 /achat-centurion/raccords-ronds/diametre-34mm https://raccords-tubes-centurion.fr/8-raccord-tubulaire-diametre-34mm
redirect 301 /achat-centurion/raccords-ronds/diametre-50mm https://raccords-tubes-centurion.fr/13-raccord-tubulaire-diametre-50mm
redirect 301 /achat-centurion/tube https://raccords-tubes-centurion.fr/22-tube-3m
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium https://raccords-tubes-centurion.fr/22-tube-3m
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium/tube-acier-brut-3m-o-30mm-epaisseur-2mm.html https://raccords-tubes-centurion.fr/tube-diametre-30mm/310-tube-acier-brut-3m-diametre-30mm-epaisseur-2mm
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium/tube-acier-galvanise-3m-o-26-9mm-epaisseur-2-3mm.html https://raccords-tubes-centurion.fr/tube-diametre-27mm/319-tube-acier-galva-3m-diametre-26-9mm-epaisseur-2-3mm
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium/tube-acier-galvanise-3m-o-42-4mm-epaisseur-2-9mm.html https://raccords-tubes-centurion.fr/tube-diametre-42-4mm/322-tube-acier-galva-3m-diametre-42-4mm-epaisseur-2-9mm
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium/tube-acier-galvanise-3m-o-60mm-epaisseur-2mm.html https://raccords-tubes-centurion.fr/tube-diametre-60mm/324-tube-acier-galva-3m-diametre-60-3mm-epaisseur-2mm
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium/tube-aluminium-3m-o-22mm-epaisseur-2mm.html https://raccords-tubes-centurion.fr/tube-diametre-22mm/297-tube-aluminium-6060-3m-diametre-22mm-epaisseur-2mm
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium/tube-aluminium-3m-o-30mm-epaisseur-2mm.html https://raccords-tubes-centurion.fr/tube-diametre-30mm/298-tube-aluminium-6060-3m-diametre-30mm-epaisseur-2mm
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium/tube-aluminium-3m-o-35mm-epaisseur-2mm.html https://raccords-tubes-centurion.fr/tube-diametre-35mm/299-tube-aluminium-6060-3m-diametre-35mm-epaisseur-2mm
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium/tubes-ronds-acier-galvanise https://raccords-tubes-centurion.fr/23-vente-tube-rond
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium/tubes-ronds-acier-inoxydable https://raccords-tubes-centurion.fr/23-vente-tube-rond
redirect 301 /achat-centurion/tube/acier-galvanise-aluminium/tubes-ronds-aluminium https://raccords-tubes-centurion.fr/22-tube-3m
redirect 301 /achat-centurion/tube/carre-acier-galvanise-aluminium https://raccords-tubes-centurion.fr/34-vente-tube-carre
redirect 301 /centurion https://raccords-tubes-centurion.fr/
redirect 301 /centurion/1-raccords-centurion https://raccords-tubes-centurion.fr/3-raccords-tubulaires
redirect 301 /centurion/4-tube https://raccords-tubes-centurion.fr/22-tube-3m
redirect 301 /centurion/garde-corps-industriel https://raccords-tubes-centurion.fr/centurion/8-garde-corps-industriel
redirect 301 /centurion/garde-corps-repliable https://raccords-tubes-centurion.fr/centurion/9-garde-corps-repliable
redirect 301 /centurion/protection-de-fosse https://raccords-tubes-centurion.fr/centurion/7-garde-corps-pour-fosse
redirect 301 /centurion/tubes https://raccords-tubes-centurion.fr/22-tube-3m
redirect 301 /component/content/article/8-nos-produits/1-raccords-centurion https://raccords-tubes-centurion.fr/3-raccords-tubulaires
redirect 301 /contact https://raccords-tubes-centurion.fr/nous-contacter
redirect 301 /achat-centurion/outils https://raccords-tubes-centurion.fr/
redirect 301 /centurion/assemblage-tubulaire https://raccords-tubes-centurion.fr/3-raccords-tubulaires
redirect 301 /centurion/tubes https://raccords-tubes-centurion.fr/22-tube-3m
redirect 301 /vos-structures-tubulaires https://raccords-tubes-centurion.fr/
redirect 301 /telechargement-raccords-3d https://raccords-tubes-centurion.fr/


#Domain: raccords-tubes-centurion.fr
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]

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

# Images
RewriteCond %{HTTP_HOST} ^raccords-tubes-centurion.fr$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^raccords-tubes-centurion.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} ^raccords-tubes-centurion.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]
RewriteCond %{HTTP_HOST} ^raccords-tubes-centurion.fr$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteCond %{HTTP_HOST} ^raccords-tubes-centurion.fr$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteCond %{HTTP_HOST} ^raccords-tubes-centurion.fr$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteCond %{HTTP_HOST} ^raccords-tubes-centurion.fr$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteCond %{HTTP_HOST} ^raccords-tubes-centurion.fr$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteCond %{HTTP_HOST} ^raccords-tubes-centurion.fr$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^raccords-tubes-centurion.fr$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
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
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/font-woff .woff
AddType font/woff2 .woff2
<IfModule mod_headers.c>
	<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">
		Header set 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

Est ce que quelqu'un voit ce qui cloche ?

Merci beaucoup,

 

David

 

Link to comment
Share on other sites

1/ Déjà, il serait bien de lire le fichier où tu écris. ça t'évitera des déboires ultérieurs:

# ~~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

2/ tu as un nginx qui sert ton site. n général nginx ne lit pas les .htaccess

3/ redirect est une directive de mod_alias sous apache. Est-il bien activé?

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

Bonjour Doekia et merci pour ta réponse.

13 minutes ago, doekia said:

/ Déjà, il serait bien de lire le fichier où tu écrit. ça t'évitera des déboires ultérieurs:


# ~~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

Cela veut-il dire qu'il faut que je dois placer mes redirections entre ces 3 lignes de commentaire ?

Pour les points 2/ et 3/ je ne pense pas qu'il y ai un problème de ce coté là parce-que je n'est pas de problème de redirection 301 avec mes autres sites sous joomla!

Ce que je ne comprends pas, c'est que j'ai bien des url qui sont redirigées mais elles sont redirigées vers de mauvaises url. Par exemple :

/achat-centurion/raccords-carres/20x20 vas être redirigé vers : https://raccords-tubes-centurion.fr//raccords-carres/20x20 (404) au lieux d'être redirigé vers https://raccords-tubes-centurion.fr/16-raccord-tubulaire-carre-20x20mm

N'y a t il pas un problème dans mon .htaccess ?

Link to comment
Share on other sites

Peut-être que le plus simple pour gagner du temps c'est que tu nous dise ce que tu acceptes de vérifier des réponses que l'on te fera.
Voire même, encore plus simple, dis nous ce que tu sais être la cause.

--2019-04-01 15:08:50--  https://raccords-tubes-centurion.fr/achat-centurion/raccords-carres/20x20
Resolving raccords-tubes-centurion.fr (raccords-tubes-centurion.fr)... 109.234.162.43
Connecting to raccords-tubes-centurion.fr (raccords-tubes-centurion.fr)|109.234.162.43|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 301 Moved Permanently
  Server: o2switch PowerBoost
  Date: Mon, 01 Apr 2019 13:08:49 GMT
  Content-Type: text/html; charset=iso-8859-1
  Content-Length: 269
  Connection: keep-alive
  Location: https://www.raccords-tubes-centurion.fr/raccords-carres/20x20
Location: https://www.raccords-tubes-centurion.fr/raccords-carres/20x20 [following]
--2019-04-01 15:08:50--  https://www.raccords-tubes-centurion.fr/raccords-carres/20x20
Resolving www.raccords-tubes-centurion.fr (www.raccords-tubes-centurion.fr)... 109.234.162.43
Connecting to www.raccords-tubes-centurion.fr (www.raccords-tubes-centurion.fr)|109.234.162.43|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 301 Moved Permanently
  Server: o2switch PowerBoost
  Date: Mon, 01 Apr 2019 13:08:49 GMT
  Content-Type: text/html; charset=utf-8
  Content-Length: 0
  Connection: keep-alive
  Location: http://raccords-tubes-centurion.fr/raccords-carres/20x20
Location: http://raccords-tubes-centurion.fr/raccords-carres/20x20 [following]
--2019-04-01 15:08:50--  http://raccords-tubes-centurion.fr/raccords-carres/20x20
Connecting to raccords-tubes-centurion.fr (raccords-tubes-centurion.fr)|109.234.162.43|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 404 Not Found
  Server: o2switch PowerBoost
  Date: Mon, 01 Apr 2019 13:08:50 GMT
  Content-Type: text/html; charset=utf-8
  Transfer-Encoding: chunked
  Connection: keep-alive
  Vary: Accept-Encoding
  P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"
  Powered-By: PrestaShop
  Expires: Thu, 19 Nov 1981 08:52:00 GMT
  Cache-Control: no-store, no-cache, must-revalidate
  Pragma: no-cache
  Set-Cookie: PHPSESSID=a05c36a335345250ebe64a46759c5272; path=/
2019-04-01 15:08:51 ERROR 404: Not Found.

 

Link to comment
Share on other sites

1 hour ago, doekia said:

Peut-être que le plus simple pour gagner du temps c'est que tu nous dise ce que tu acceptes de vérifier des réponses que l'on te fera.
Voire même, encore plus simple, dis nous ce que tu sais être la cause.

Pardon @doekia je veux bien tout tester. Mais je ne sais pas comment m'y prendre.

 

2 hours ago, doekia said:

2/ tu as un nginx qui sert ton site. n général nginx ne lit pas les .htaccess

Je peux le changer, comment remedier à ce problème ?

2 hours ago, doekia said:

3/ redirect est une directive de mod_alias sous apache. Est-il bien activé?

Je ne sais pas ou vérifier s'il est activé

Link to comment
Share on other sites

Quand un navigateur demande ceci:

--2019-04-01 15:08:50--  https://raccords-tubes-centurion.fr/achat-centurion/raccords-carres/20x20

quelque chose lui répond:

Location: https://www.raccords-tubes-centurion.fr/raccords-carres/20x20

le navigateur demande alors

--2019-04-01 15:08:50--  https://www.raccords-tubes-centurion.fr/raccords-carres/20x20

ça lui répond cici

Location: http://raccords-tubes-centurion.fr/raccords-carres/20x20

 

J'en déduis, qu'en amont de prestashop, et donc de son .htaccess, quelque chose s'en mèle et élimine /achat-centurion de l'url

A partir de la tes règles ne peuvent fonctionner puisque achat-centurion n'est plus dans l'url

Note aussi le dangling entre http et https (probablement car nginx sert de terminaison ssl et ne le dit pas correctement à prestashop)

 

Vérifie ton nginx, rédémarre-le pour être sûr qu'il relise ta config

Edited by doekia (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...