I have a website called xyz.com and added additional store called abc.xyz.com.

Now I have purchased new domain 123.com.

How can I redirect my subdomain as a new domain, like if customer enter 123.com it will be redirected to abc.xyz.com, and URL should be like 123.com not changing to abc.xyz.com in the URL bar?

  • Solved my self, just add add-on-domain, path is your store root folder, simple.
    – zus
    Jun 19, 2018 at 5:16

2 Answers 2


You Have to add below code into the .htaccsess file for that.

RewriteCond %{HTTP_HOST} ^123.com
RewriteRule ^(.*) http://abc.xyz.com/$1 [P]
  • Let me clarify this, now my .htaccess look like -> RewriteCond %{HTTP_HOST} ^(.*)xyz-dot-com/abc RewriteRule ^ - [E=MAGE_RUN_CODE:abc_en], Here how can i change?
    – zus
    Jun 15, 2018 at 5:31
  • better view : justpaste.it/6147s
    – zus
    Jun 15, 2018 at 5:32

Please add this code in .htaccess file in Magento root after <IfModule mod_rewrite.c> tag.

RewriteEngine on 
RewriteRule ^(.*)$ http://abc.xyz.com/[R=301]

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.