0
votes

I am trying to implement 301 redirect from old web-site to new web-site url structure (custom CMS). In my example I am trying to redirect this structure:

/shop/my-product-name

to

/fr/my-product-name

This is what I have, but the web-site shows me empty page:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteRule ^index\.html$ / [R=301,L]
RewriteBase /


RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

RewriteRule ^/shop/(.*)$ /fr/$1 [R=301,L]

RewriteRule ^(en|fr|de|es|it)/?$ index.php?lang=$1 [QSA,L]

RewriteRule ^(en|fr|de|es|it)/news/?$ index.php?lang=$1&section=blogposts [QSA,L]

it seems to me that the code is absolutely fine. What am I doing wrong? Thanks

1

1 Answers

0
votes

It should be

RewriteRule ^shop/(.*)?$ fr/$2 [R=301,L]

as it happens the problem was with leading slash in the beginning