Answer the question
In order to leave comments, you need to log in
How to make a redirect in Prestashop?
There is a site arthata.by on prestashop
It has a product category arthata.by/module
The
question began to excite. It seems to me that some people go to the page arthata.by/module without a slash at the end /
And it has a 404 error
How to make a redirect? in htaccess? In the press itself? How to avoid duplicate page for SEO?
Answer the question
In order to leave comments, you need to log in
I'll start with the fact that it just so happened that in Prestashop, usually, pages end without a slash.
So check your modules and make sure they make pages without trailing slashes.
If you still need to make some specific static page with a slash, so that there are no duplicates, then add a 301 (full) redirect line for this page to .htaccess:
and so that this entry does not get lost when updating the cache, in the file ../your_site/classes/Tools.php
find the entry: fwrite($write_fd, "</IfModule>\n\n");
(or similar, at about line 2500) .
Insert below it:
fwrite($write_fd, "Redirect 301 /module /module/\n");
fwrite($write_fd, 'RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]'."\n\n");
fwrite($write_fd, "RewriteCond %{REQUEST_URI} ^/module$\n");
fwrite($write_fd, "RewriteRule .+ ".(Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://')."".$domain."/module/ [R=301,L]\n\n");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question