I have magento website in custom.com domain, and now I want to access complete frontend website content from one more domain also says custom1.com. Admin url will be same as custom.com/admin.

I have pointed new domain to custom.com server.

Is it possible to rewrite using htaccess rewrite rule, If yes then how?

2 Answers 2

I have run Multistore in magento2 by adding code in index.php.

I have replaced code in index.php 

    $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');


$params = $_SERVER;
switch($_SERVER['HTTP_HOST']) {
    case 'abc.com':
    case 'www.abc.com':
     $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website_code1';
   $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
    case 'test.com':
    case 'test2.co.uk':
    case 'www.test2.co.uk':
      $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'base';
   $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');

This code is working fine for me,hope it will help you.


It looks like you want to manage multiple stores with your Magento 1.9 instance. You require each store to have a different domain. Here are the basic steps.

  1. Create the additional store in System -> Manage Stores. the documentation is found here.

  2. Setup the secure and unsecure URLs in System -> Configuration -> General -> Web. You will have to select the scope for each website before entering the website URLs. The Documentation for scope configuration can be found here.

  3. Update the .htaccess file in the root directory of your Magento website. Here is an example of the code where base is the code for the first website and web is the code for the second website.

    SetEnvIf Host www\.custom\.com MAGE_RUN_CODE=base
    SetEnvIf Host www\.custom\.com MAGE_RUN_TYPE=website
    SetEnvIf Host www\.custom1\.com MAGE_RUN_CODE=web
    SetEnvIf Host www\.custom1t\.com MAGE_RUN_TYPE=website
  4. Clear your cache to make your changes effective.

We are assuming your web server is already configured to recognize both the www.custom.com and the www.custom1.com host names pointing to the same Magento root directory.

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.