Moving a Drupal multisite install to localhost (OS X and MAMP)


Moving a Drupal website from one hosting provider to another is not an easy task. Moving a multisite website to a localhost has some added layers of complexity. That's the reason for this short tutorial with a description of the process. Environment: OS X Mavericks and MAMP.

Log into the website and install the Backup and Migrate module. Download your database to a location on your hard disk. Backup and Migrate works much better than a manual export of the database.

Connect to your website via FTP. Copy all the files to your hard disk, except the /sites folder. From the sites folder you only move the folders /all en /

Keep settings.php, which you can find at /sites/, as much as possible in it's initial state. This means you have to look into settings.php and create that user in phpmyamdin (of course with the needed permissions).

Go to httpd.conf under /Applications/MAMP/conf/apache and look for 'Virtual Hosts'. Make sure the Virtual Hosts are accessible for the multisite config at the localhost by uncommenting an include:

# Virtual hosts
    Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

Go to the vhosts file at /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf and change the port of the NameVirtualHost from 80 to 8888. You can check the Preferences of MAMP to be sure of the exact port.

NameVirtualHost *:8888

Add the vhost to the same httpd-vhosts.conf Apache file. Hereunder an example of a configuration for the standard MAMP-port 8888 (note: the ErrorLog and CustomLog rules aren't that important):

<VirtualHost *:8888>
  DocumentRoot "/Applications/MAMP/htdocs/mywebsite"
  ErrorLog "logs/"
  CustomLog "logs/" common

Beware! For these configurations it is important we als add the normal localhost to httpd-vhosts.conf. This one has to be linked to the root, or htdocs. This looks like this:

<VirtualHost *:8888>
  DocumentRoot "/Applications/MAMP/htdocs"
  ServerName localhost

Change the hosts file of the operating system. When using Mac OS X this can be found at /private/etc/hosts. Add following code to the file (and save the file):

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.