0

Is it possible to set different domains on one website name in Magento 1.9?

I want to have it like this: enter image description here

Is it even possible to set this in store level?

EDIT: I also did the costumisation in index.php file

if(stripos($http_host, 'mywebsite.de') !== false){
    $mageRunCode = "mywebsite";
    $mageRunType = "website";
}elseif(stripos($http_host, 'mywebsite.com') !== false){
    $mageRunCode = "mywebsite";
    $mageRunType = "website";
}

and set the Base URL on different Current Configuration Scopes.

4

Yes, you just need to create a default store and view to each one.


You can Manage your stores like that on System > Manage Stores.

Manage Store

You will need to change the scope to define the base URL like that image below.

Base URL on Store View

Some devs change the index.php like that below.

But the better way to handle switching the run code and run type is to use your Apache or Nginx configuration on the Virtual Host instead of modifying a "core" file (index.php).

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

switch($_SERVER['SERVER_NAME']) {
    case "www.store2.com":
    case "store2.com":
        $mageRunCode="base2";
        $mageRunType="website";
        break;
    default:
        $mageRunCode="base";
        $mageRunType="website";
        break;
}
  • An how do i connect it to the different domains? – Navitua May 4 '17 at 7:30
  • Point all the domains to the same server, and in the configuration set the proper (secure) base url for the specific stores. Magento will do the rest. – Giel Berkers May 4 '17 at 7:52
  • 1
    Rafael's comment is 99% correct. The better way to handle switching the run code and run type is to use your Apache or Nginx configuration on the Virtual Host instead of modifying a "core" file (index.php). – Brett May 4 '17 at 16:30
1

In System -> Manage Stores you can create Website, stores and stores views.

Create Website: mywebsite, Create Store: mywebsite.de and mywebsite.com, Create Store View: English, French and German for each stores.

In System -> Configuration choose Current Configuration Scope and set the settings Base Url of each domain for Secure or Unsecure in the Web tab

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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