Top Question Answers about PrestaShop URL Redirect Module
Posted On: Sep 14, 2018
Categories: Shopping Carts & Platforms
URL redirect is a technique that is used to redirect your domain's visitors to a different URL without any traffic loss. You can forward your domain name to any website, webpage, etc. that is available online.
URL redirect has now become an essential task for most of the merchants. They need to redirect their shops for many of the following purposes:
- When a site needs maintenance, merchants have to redirect it to another domain for a short period
- When a store is completely shut down and shifts to another domain
- When merchants want to redirect from HTTP to the HTTP server
- When merchants have to redirect non-www to www protocol.
- When merchants migrate from other shopping carts to PrestaShop
By default, the PrestaShop redirect does not come for free. The platform lacks options to redirect URLs. So, two methods can do this. However, our topic is not related to defining the way to redirect but we will confine to some common problems and their solutions related to PrestaShop redirection. So here are the top answers to PrestaShop URL Redirect most asked questions.
Question No. 1: I am using PrestaShop 1.6.0.9 and I have multistore enabled. I have migrated my shops from other shopping carts to PrestaShop. So I want to 301 redirect all my products and categories so that Google will index my new URLs keeping my old ranking. Is it possible to add redirects through the htaccess file or does it follow some other formula?
Answer: It can be done through php files instead of htaccess. Just create a file named “old_sit_redirect.php and paste the following code in it. Here you have an old URL and a new URL as per your URLs.
$url_redir_maps = array(
'/some_old_url.html' => '/some_new_url',
'/old_url2' => '/new_url2',
(...and so on)
);
if(in_array(@$_SERVER['REQUEST_URI'], array_keys($url_redir_maps))){
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$url_redir_maps[@$_SERVER['REQUEST_URI']]);
exit;
}
Question No. 2: Hi, I am using the default PrestaShop module for redirect but the header that it is generating is wrong. The URL is with the header https but when it redirects, it goes to the http version.
Answer: Try to paste the exact URL before passing it to the Tools::redirect() function and then see that either it is redirecting to http or https. However, the point to be noted is that this PrestaShop function can’t do such task of changing the version from https to http. It may be a problem with the redirecting URL.
Question No. 3: I have migrated my store from another shopping cart to PrestaShop and I want to redirect the old URLs to new URLs. When I redirect, old pages are not correctly redirecting to new URLs. The reason for this issue is that I am not using www at the start. I am not using it because If I use it, I will be unable to login to my store. Also, in this way, my customers can’t log in to their accounts. How can I solve this issue?
Answer: To solve this issue of www and non-www, you have to include the following code at the top of your taxes.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Question No. 4: I have shifted my old shopping cart to PrestaShop and I want to redirect all my old URLs to new ones so that I can avoid the 404 error for those old pages that are indexed by Google.
example:
old site: http://www.xyz.com/acatalog/
new site: http://www.xyz.com
Answer: You can do this by adding these lines in the htaccess file. It is the method of 301 redirect.
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Question No. 5: I am trying to redirect my URLs in PrestaShop 1.5.4. I tried different methods of redirection through htaccess file by adding code after, before, and inside, but nothing solved the issue. As the old URLs are not redirecting to new URLs correctly.
Answer: You have to place the following code at the top of the index.php file.
if (strpos($_SERVER['REQUEST_URI'], OLD_URL_GOES_HERE) !== false) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: OLD_URL_GOES_HERE");
exit();
}
Question No. 6: I've installed a PrestaShop URL redirect module, but it doesn't seem to be working as expected. How can I troubleshoot and fix the redirection issues?
Answer: Check the Prestashop redirect module settings to ensure that the redirection rules are configured correctly. Verify that the old URLs and corresponding new URLs are accurate. Additionally, clear your shop's cache to ensure that the changes take effect. If the issue persists, review any error logs provided by the module for insights into potential issues.
Question No. 7: I'm running a seasonal promotion, and I want to temporarily redirect all traffic from my homepage to a special landing page. Can I set up temporary redirects using a PrestaShop redirect module?
Answer: Yes, you can typically set up temporary redirects using PrestaShop 302 redirect modules. Check the module settings for options related to redirect types and choose a temporary (302) redirect for your seasonal promotion. Don't forget to revert the redirect settings once the promotion period is over.
Question No. 8: I've noticed a significant drop in my website's SEO ranking after implementing URL redirects. How can I ensure that my SEO is not negatively impacted during the redirection process?
Answer: Ensure that you're using 301 permanent redirects rather than temporary redirects. Search engines generally recognize and pass the SEO value of the old URLs to the new ones with permanent redirects. Additionally, regularly monitor your website's performance and update your sitemap to reflect the new URLs.
Question No. 9: I have a PrestaShop store with a blog section, and I want to implement URL redirects for my blog posts. Can I use a PrestaShop redirect module specifically for my blog URLs?
Answer: Yes, PrestaShop redirect modules allow you to create redirects for specific sections of your store, including blog URLs.
Question No. 10: I have noticed that some old URLs are still appearing in search engine results even after implementing redirects. How can I expedite the removal of these outdated URLs from search engine indexes?
Answer: To expedite the removal of outdated URLs from search engine indexes, use the Google Search Console or equivalent tools. Submit a request to remove outdated URLs, and over time, search engines will update their indexes to reflect the new redirected URLs.
Note: These questions are answered by top community developers and do not reflect “FME Modules”.
Conclusion
The URL redirection technique is essential for PrestaShop merchants. This allows for smooth transitions during site maintenance, domain changes, or other updates. By directing users to the right pages, redirects can help preserve SEO rankings. PrestaShop lacks built-in URL redirection options. However, merchants can use access and PHP scripts to manage redirects.
Frequently Asked Questions
How can I set up 301 redirects for my products and categories in PrestaShop?
You can create a PHP file named “old_sit_redirect.php” and define your old and new URLs in an array to handle 301 redirects.
How can I avoid Google indexing 404 errors for old pages?
Implement 301 redirects in your htaccess file to redirect old URLs to new ones, preventing 404 errors.
Can I set up temporary redirects for a seasonal promotion?
Yes, you can use a PrestaShop redirect module to set up temporary (302) redirects for specific promotional events.
How can I prevent negative impacts on my SEO after implementing URL redirects?
Use 301 permanent redirects to maintain SEO value, and regularly monitor your site’s performance to adjust as needed.