Multisite Magento on the same server

We have so many applied cases in this topic, from customers to developers, who don’t want to pay money for unnecessary servers.

In this topic, we will show about Alias config of Apache web server. With Nginx, we will come back with other article. About Alias, it allowed user can map URI to other folders of the servers and setup website in those folders.

First thing we have to prepare is VirtualHost has been enabled in the system. Alias config will be define inside <VirtualHost></VirtualHost> blocks

Example

It’s fit to Magento system

<VirtualHost *:80>

    Alias /dev "/var/www/dev/public_html"
    <Directory "/var/www/dev/public_html">
        AllowOverride All
    </Directory>

    Alias /staging "/var/www/staging/public_html"
    <Directory "/var/www/staging/public_html">
        AllowOverride All
    </Directory>
</VirtualHost>

After setup completed, we have to restart Apache to take effect with command

sudo systemctl restart apache2

And don’t forget to change Magento path in database to fully transfer from IP to new alias url