Drupal: Testing multisite/domain-access Drupal locally and on a testing server

We’re using Domain Access to manage a number of related subdomains on a single server. I prefer to develop and test locallly, then push my changes out to a testing server so that other people can try the system. I use the same domain names on my computer and on the test server so that I don’t have to make any changes in the database. To switch between them, I comment or uncomment a line like example.com sub1.example.com sub2.example.com

in my /etc/hosts file.

However, Firefox caches the domain name information, and it can be confusing to figure out which server I’m on. The following setup makes this much easier:

  1. Install Domain Details to show the IP address of the server in your status bar. Good for a quick check – am I on or elsewhere? (NOTE: I started with ShowIP, but it looks like ShowIP caches the information.)
  2. Install the Clear Cache Button extension.
  3. Restart your browser and customize your toolbar. Add the Clear Cache button. Click on this before switching sites.

In an ideal world, I’ll have a plugin that automatically twiddles my DNS entries, too. =)

  • You could also manually edit your settings.php to override local settings. For instance, you could set the footer variable to echo the IP….

    I always edit the settings.php to set the site name to ” BETA”

  • Oh, that’s even better. =) Thanks for the tip!

  • elv

    I usually use a different favicon for local/test/live sites. I add a 2px red border for the local site, an orange one for the test site, and the regular favicon for the live site.

  • Throw in some sym links for different sub-sites, or even different versions of modules and themes and local development is a dream.

  • hi, I would like help on how to best to do all development on remote server as I use multiple pcs and web access is not an issue.

    say i have 3 sites I am working on, I would like to do all testing and design on one test domain and then move them to the appropriate domain when done.


    then when the sites are ready to go live


    issues I run into are relative hyperlinks breaking due to site sturcture being different on test vs live.

    Any ideas would be much appricated.

  • Always use url(..) for hyperlinks instead of hardcoding them directly.

    Also, you can make your test environment more like your production environment by using domain names. For example, I like mapping qa.site1.com, qa.site2.com, and qa.site3.com to my test environment. Use Apache virtual hosts to make this happen.

  • Hi Sacha,

    thanks for the info. I also found this drupal module that helps with deployment – aptly name http://drupal.org/project/deploy

    checkout this youtube video

  • Yup! Greg Dunlap was telling me about Deploy at DrupalCon 2009. It’s good stuff too, and something you can probably use along with this everything-in-code approach. =)

  • Wai Wong

    I’m planning to learn domain access module. Do you know of any good source or info on how to set it up?