0

I configured my Magento 2 store to ends with trailing slash. This work great.

But when I browse the same page without trailing slash, it redirects to a 404 error page, and not to the trailing slash versión.

Why does it not redirect automatically? Do I need to configure something?

Thanks in advance!

0

I resolve the problem tunning my .htaccess

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^robots.txt - [L]
RewriteRule ^sitemap.xml - [L]
RewriteRule ^BingSiteAuth.xml - [L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^/rest/*
RewriteCond %{REQUEST_URI} !^/customer/*
RewriteCond %{REQUEST_URI} !^/labotiga_admin/*
RewriteCond %{REQUEST_URI} !^/redsys/*
RewriteCond %{REQUEST_URI} !^/category/*
RewriteCond %{REQUEST_URI} !^/recaptcha/*
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [L,R=301]
RewriteRule .* index.php [L]

The first part like robots.txt is to not add trailing slash on these files.

The second part of /customer/* is to not add trailing slash also on some important directories

Finally we add trailing slash with last rule.

Hope you use it or help to solve these problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.