Some time ago, I’ve showed that how you can redirect URLs in Magento using URL Rewrite Management built in feature of Magento. Sometimes it happens when you can’t redirect URL using URL Rewrite Management; at that time you can use the file .htaccess to redirect those URLs. There are different syntaxes to redirect URL in .htaccess file but the following method works for Magento. Follow the steps to redirect URLs.
- Open the .htaccess file of your Magento website.
- Search for the field “enable rewrites” in that file. You can find your previous URL rewrites here and you should done your all the URL rewrite here as it’s best practices to put your all URL redirection at same place.
- Here is the syntax to redirect any URL:
RewriteRule ^OLD-URL-TO-REDIRECT?$ NEW-URL-WHERE-YOU-WANT-TO-REDIRECT-THE-OLD-ONE [R=301,L]
- You don’t have to write “RewriteEngine on” every time. It is just one time process. RewriteEngine should be enabled to order to redirect the URLs from .htaccess.
- Save these changes in .htaccess file.
And you’re done; you can check the old URL which will be now redirected to New URL if you followed the procedure correct.
Drop me a line if you are unable to redirect URL using this method.