Skip to main content

How to point Magento multi websites to domains

Backend configurations
Add secure and unsecure domain urls for websites
Add default domain url default config

Index.php changes
You need edit index.php file as follows

switch($_SERVER['HTTP_HOST']) {
    case 'domain.co.uk':
    case 'www. domain.co.uk':
        $mageRunCode = 'base';
        $mageRunType = 'website';
    break;
    case ' domain.eu':
    case 'www. domain.eu':
        $mageRunCode = 'euwebsite';
        $mageRunType = 'website';
    break;
}
Comment following lines if you have
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

 Point main domain by adding your hosting server dns in domain registrar
                It will take some time to resolve DNS settings. Use intodns.com to check dns of a domain.

 Then you need to point other domain. There are two ways.

 Using cPanel
 Go to parked domain in bottom of the cpanel
Add your domain. It will automatically point to your public_domain

Sometimes you may get error as follows
Sorry, the domain is already pointed to an IP address that does not appear to use DNS servers associated with this server. Please transfer the domain to this servers nameservers or have your administrator add one of its nameservers to /etc/ips.remotedns and make the proper A entries on that remote nameserver.
This is an issue in DNS setting or WHM setting
                Check DNS first whether it is resolve or not
                If it is ok go to WHM > Tweak Settings > Domains > Allow Remote Domains
Switch the option to On and click on Save. Now you can add parked domain.
Make sure to off after setup parked domain
Using WHM
You can also park a domain in the WebHost Manager using Home » DNS Functions » Park a Domain


Have fun... :-)

Comments