3

I have a production site at example.com (with a subdomain multi-install) and I have been meaning to setup a development environment at beta.example.com (also having all of the multi-sites). I would like these machines to be as identical to each other as possible so the push from the development machine to the production machine goes very smoothly. Is it possible to have the sites folders named the same on the development machine as they are named on the production machine? That is, they do not have beta in the file name. Does this involve hostname rewriting? Can apache even do that?

  • What version of Drupal? – mpdonadio Sep 6 '12 at 17:49
  • @MPD initially 6 and then transitioning to 7 on the new development machine. – Patrick James McDougle Sep 6 '12 at 18:26
3

Yes it is possible to have the same DIR structure as on your live site using sym links.

Suppose subsite.example.com is a folder on live site on production you need a link like beta-subsite.example.com -> subsite.example.com And you can use subsite.example.com in both your environments.

SO folders on Live site will be

  • default
  • subsite.example.com

In dev environment one extra link has to be created pointing to subsite.example.com.

  • so the dev box has a symlink from subdomain.beta.example.com to subdomain.example.com which actually houses the settings file and such? – Patrick James McDougle Sep 6 '12 at 17:31
  • What does this do to file paths in the db? Are they pointing to subdomain.beta.example.com or subdomain.example.com? – Patrick James McDougle Sep 6 '12 at 17:32
  • I guess the files might be a non-issue because you don't need file uniformity across environments. – Patrick James McDougle Sep 6 '12 at 17:33
  • 1
    Yes files will remain as it is on live server, what do you mean by file paths ? you mean uploaded docs/images/pdfs ? It will take what ever path is configured in file system setting, so I dont see a problem. You should be able to copy files from prod to stage and vice versa without any changes to DIR structure. – GoodSp33d Sep 7 '12 at 5:27
  • alrighty, that makes sense. – Patrick James McDougle Sep 7 '12 at 18:01
3

@kantu's answer makes sense for Drupal 6.

When you migrate to Drupal 7, you can create a sites.php file. In it, you can create mappings from domain/path/port triplets (eg, the parts of the HTTP request) to paths within sites. For example, you could make

$sites['beta.example.com'] = 'example.com';

and this would map requests from beta.example.com to sites/example.com/.

I don't really see a way around having individual settings.php files for each, though.

  • This is fantastic! Having individual settings files is fine, I just want to rewrite the hostname before drupal looks at the sites folders (which is what your answer does [I think]). – Patrick James McDougle Sep 7 '12 at 17:54
  • Yeah, that is what sites.php does in Drupal 7. – mpdonadio Sep 7 '12 at 18:02
  • 1
    I don't know who to give the accepted answer to, since both are technically correct. – Patrick James McDougle Sep 7 '12 at 18:11
  • 1
    @PatrickJamesMcDougle, give it to kantu, he answered first and will benefit more from the rep. – mpdonadio Sep 7 '12 at 18:46
  • How honorable :D – Patrick James McDougle Sep 7 '12 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.