0

We got a problem with our Magento Store and the Multi Domain System + Stores.

We created 3 domains like:

  • domain1.com
  • domain2.com
  • domain3.com

All domains have own stores and storeviews.

In the Configuration Tab of the Admin Panel we set the Base URLs for secure and unsecure to the URL of each domain.

Our domains pointing into the root dir of the magento installation.

We tried to edit the .htaccess file of the Magento like in this tutorail :

http://www.ecommercegorilla.com/how-to-set-up-multiple-store-fronts-with-magento/

Without any success.

We tried to edit the index.php but after we did this and uploaded the new index.php we got an empty browser tab which is pointing into our root dir of magento.

This is our code from the index.php:

<?php
/**


if (version_compare(phpversion(), '5.2.0', '<')===true) {
    echo  '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer. <a href="http://www.magentocommerce.com/install" target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
    exit;
}

/**
 * Error reporting
 */
error_reporting(E_ALL | E_STRICT);

/**
 * Compilation includes configuration file
 */
$compilerConfig = 'includes/config.php';
if (file_exists($compilerConfig)) {
    include $compilerConfig;
}

$mageFilename = 'app/Mage.php';

if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename." was not found";
    }
    exit;
}

require_once $mageFilename;

#Varien_Profiler::enable();

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}

#ini_set('display_errors', 1);

umask(0);

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

if(!isset($_SERVER['MAGE_RUN_CODE']) || !isset($_SERVER['MAGE_RUN_TYPE'])) {
    switch($_SERVER['HTTP_HOST'] {

  case 'domain3.com':
  case 'www.domain3.com':
$mageRunCode = 'domain3_de';
$mageRundType ='website';
break;

  case 'domain2.com':
  case 'www.domain2.com':
$mageRunCode = 'domain2_de';
$mageRundType ='website';
break;

case 'domain1.com':
case 'www.domain1.com':
default:
$mageRunCode = 'base';
$mageRundType ='website';
break;

}

}

Mage::run($mageRunCode, $mageRunType);

is there a problem with our index.php ?!? We are glad for any help.

Kind regards

4 Answers 4

1

In regards to your second question:

I would avoid domain names with Umlauten - Full Stop.

If you were so free to purchase and use such a domain, I would also buy the domain without umlaute and redirect the umlaute-domain to the one without

eg: geldsüchtling.com => geldsuechtling.com

this one without any umlaute should handle all your functionality andhost your site - the other is simply a 'bonus' domain for your business which should NOT handle or host anything, just redirect.

Umlaut support in domain names is pretty bad and i can not recommend it - and yes, I have a few stores on domains where we have done the above because actually using such a domain is a right pain.

1

Umlaut domains should not be a problem, as long as you use the punycode encoded domain name in your code:

switch($_SERVER['HTTP_HOST']) {
  // brücke.de
  case 'www.xn--brcke-lva.de':
    ...
    break;
}

In case you don't know how to convert your domain to punycode you can use one of the myriad of punycode converters found online, e.g. https://www.punycoder.com/

0

Try your index.php like this:

/* 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['HTTP_HOST']) {

        case "domain1.com":
        case "www.domain1.com":
                $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'domain1';
                $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'website';
                break;


        case "domain2.com":
        case "www.domain2.com":
                $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'domain2';
                $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'website';
                break;


        case "domain3.com":
        case "www.domain3.com":
                $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'domain3';
                $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'website';
                break;

        default:
                $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'domain1';
                $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

                break;
}

Mage::run($mageRunCode, $mageRunType);
0

The Code helped me out. The redirecting into the shops works now.

But i have another problem with our Multi-Shop-System.

Our domainnames contains german umlaut like ä,ö,ü. One multishop works, the other one with german umlaut dont.

If we test our domain that contains german umlaut ö, our browser is redirecting us to the default shop. How is it possible to manage magento, that magento knows that this shop with an german umlaut domain is an own shop ?!?

Temporarily we added a URL Redirecting without german umlaut, but this solution cant last long.

We are glad for any help again.

Kind regards

1
  • If the code helped you out, please mark it as the answer! (it's how this place works!)
    – tecjam
    Mar 17, 2015 at 13:44

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.