3 ways to set up redirects in Magento
Whenever you redesign a Magento site, or migrate to Magento, you may need to add redirects if URLs have changed without the database knowing about it. (In Magento, if you only rename…
Whenever you redesign a Magento site, or migrate to Magento, you may need to add redirects if URLs have changed without the database knowing about it. (In Magento, if you only rename the URL key of a product or a category, it will offer to manage the redirect in the database.)
The two methods compatible with the redirects generated automatically by swan.tools are of course the first two: adding them to the .htaccess file and to the vhost.
SEO redirects in the .htaccess file
This is the most common method: adding the SEO redirects for Magento inside the .htaccess file at the root of the directory.
We recommend placing these redirects inside the rewrite module to secure them, just after this section:
<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
############################################
## you can put here your magento root folder
## path relative to web root
#RewriteBase /magento/
Example of a redirect in the .htaccess file
Redirects in the vhost
The solution recommended above is not the most efficient in terms of performance. To optimise your server's performance, it is better to add the redirects directly to the Apache or Nginx configuration of your server. The .htaccess file is read again by Apache on every request, whereas the server configuration is loaded only once, at startup: this reduces the processing time of every page. Be careful, however: you will lose some "maintainability", because this configuration file is harder to access if you are not the administrator of your hosting. To compare the possible locations, see where to place your redirect plan.
Redirects in the Magento back office
This is the most accessible solution for a user with little IT experience. However, it is also the least efficient in terms of access time, so it should be used as little as possible.

Accessing redirects in the Magento back office
Once on the page, you can add a new redirect by clicking the button at the top right: Add URL Rewrite.

Form for adding database redirects in Magento
On this screen you can easily set up a redirect, and also specify the context (store view) directly in the line. Our advice here is to add an easily identifiable comment so that, when you manage it later, you know why you set up this redirect.
Which types of migration does this tutorial apply to?
You can apply these instructions to any type of migration: from a custom development, from a PrestaShop migration or WooCommerce, redirects from Shopify, or even as part of a Magento site redesign.
Understanding and applying these different redirect methods is crucial when migrating or redesigning your Magento site. However, it is just as essential to anticipate the costs of these operations to ensure a smooth and efficient transition. For an in-depth understanding of the costs involved and a personalised estimate, visit our page on website migration pricing.