Jump to content

htaccess RedirectPermanent BUG


Recommended Posts

Hi,

 

I had a Prestashop 1.7 at the root of the domain name, but i have change it to a sub-repertory named "shop"

When the shop was at the root i used the index .php of Prestashop but not now.

I have an index.php page separate from the shop.

But all the redirections of categorys i had aren't workink now :(

Must i have to put the 301 .htaccess category & sub-category redirection in an .htaccess at the root of the "shop" or the "domain name"?

Here is my .htacces who doen't works :(

I loss a lot of indexation so if someone experimented on this subject can help me?

Best regards and wait for your feedbacks :)

Kolorslab

HTACCESS KO

# ~~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
RedirectPermanent /130-category https://www.domain.com/shop/130-paintball-tir/
RedirectPermanent /182-category/ https://www.domain.com/shop/130-paintball-tir
RedirectPermanent /182-category/ https://www.domain.com/shop/130-paintball-tir

#Domain: domain.com
RewriteRule . - [E=REWRITEBASE:/shop/]
RewriteRule ^api$ api/ [L]

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

# Images
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
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]
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]
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]
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]
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]
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]
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
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 /shop/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

 

 

Link to comment
Share on other sites

Premièrement, ne t'en déplaise, nous sommes ici dans la section française du forum.
A toi donc de faire un minimum d'effort pour soit parler français, soit poster dans une section adapté à ta langue

Deuxièmement tu ne dois pas inclure tes règles spécifique à l'intérieur de la section du .htaccess sous le controle de prestashop.
Le commentaire en anglais semble pourtant très clair - merci de le lire

Troisièmement tu es en train de manipuler le .htaccess à l'intérieur de ton répertoire shop alors que si je comprends bien ton problème, il s'agit de faire la redirection depuis le niveau supérieur.
Autrement dit depuis un .htaccess situé directement dans ton DOCROOT

 

 

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

Bonjour,

 

Désolé je vais m'exprimer en FR.

J'ai déplacé le Prestashop 1.7 qui était à la racine du site de mo,n client et sur lequel je faisais des redirections 301 pour certaines catégories sans souci.

 

Aujourd'hui si ma boutique fonctionne très bien les redirections dans le .htaccess - soit les urls indexées que j'avais listé et sur lesquelles j'ai fait des redirections permanentes - ne fonctionnent plus.

 

j'ai à la racine de l'hébergement une page totalement indépendante du PS1.7 et mes redirections ne fonctionnent pas

 

Si qq1 peut m'aider c'est speed car je me fais désindexer d'heure en heure :(

 

Merci à vous !

 

kolorslab

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