I have been working in a single installation of Drupal 7, which has two sites built upon it.

In Drupal 7 multiple sites are served by naming a directory for each site to be served under /sites and include settings, themes and modules specific to that site.

|__ 8888.website-one.dev
|   |__ settings.php
|   |__ files
|   |__ themes
|__ 8888.website-two.dev
    |__ settings.php
    |__ files
    |__ themes

So the system identifies the site based upon the domain (in my case the preceding 8888 is the port number I use to work internally).

When I push this installation to a remote dev server using Git, the domains I use to access the installation will need to change, and so the directory names would have to change too; which means that I wouldn't be able to have the installation working on both my local and remote development boxes.

Is it possible, with Git, to change a directory name on the remote server, and keep it the same on my local server, while still tracking the files inside those folders?

Many thanks!

1 Answer 1


You don't need to consider a whacky git-based solution to this, Drupal has you covered.

Just uses aliases in sites.php, and use whatever method you like (assume-unchanged in the index, .gitignore, whatever) to keep sites.php out of the repo.

So on your local machine your sites.php might contain

$sites['website-one.dev'] = 'website-one';
$sites['website-two.dev'] = 'website-two';

And on a remote server:

$sites['website-one.staging'] = 'website-one';
$sites['website-two.staging'] = 'website-two';

And prod:

$sites['website-one.com'] = 'website-one';
$sites['website-two.com'] = 'website-two';

All the while, your sites live in 'website-one' and 'website-two' respectively; no need for tricks.

If you don't want to consider a Drupal-based solution, and still want to use git, I'd advise taking this over to Stack Overflow where such a question would be on-topic.


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.