Suppose I have a Magento page www.ce.li/apparel.html and my site has an alias name, say abc.ce.li. When I access abc.ce.li/apparel.html (using alias abc instead of www) Magento redirects me to it's home page, www.ce.li. How can I change such behavior? I want to get to www.ce.li/apparel.html, not to homepage.


  • It turned out that there is a solution for my problem (I was not the first who asked this question): Go to System->Configuration->Web->Url Options and set 'No' for 'Auto-redirect to Base URL'.
    – Boris G.
    Commented Feb 20, 2014 at 11:42
  • add your solution as answer and accept it to close the question. Thanks Commented Feb 24, 2014 at 21:06

2 Answers 2


Easiest way to do this is with an htaccess rewrite rule

RewriteCond %{HTTP_HOST} ^abc.ce.li$
RewriteRule (.*)$ http://www.ce.li/$1 [R=301,L]

This way the request will never reach Magento and have a nice SEO friendly redirect to the right domain.


While disabling redirect to base URL will work, it isn't a good solution. The redirect to base URL is there for the case where you have a wildcard DNS entry for your domain or have migrated from one subdomain URL to another (say shop.example.com to megastore.example.com). In this case you don't want to loose the organic traffic, so you keep the DNS entry alive, but you want people to recognize the new URL so they get redirected. For this situation, Sander's answer is actually better, because Magento only redirects to the homepage and forgets the rest of the URL, while solving this outside Magento allows you to retain the full URL, not to mention less load on the server.

The real solution is understanding how Magento deals with Websites and Stores. A URL is bound to a website or store and they have a base URL defined in System > Config > [Web] > Secure and Unsecure.

This is also why disabling redirect to base URL isn't a good solution. While it will prevent the redirect, the links generated in that page will point to the store's URL, in your case www.ce.li.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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