Change URL of a multi-site

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by no2e on January 26, 2009 at 7:58pm

Introduction
At the moment, there is a static website at foobar.example.com. I want to use Drupal (multi-site) to build a new site at this domain. But until it is finished, the static website shall stay.

Is it possible?
Can I create a multi-site at foobar2.example.com, build the site, and later rename the folder inside of sites from foobar2.example.com to foobar.example.com and change $base_url inside of the settings.php to the new domain? Anything else?
Or is this not possible without any problems?

Other solutions?

Comments

Yes

Posted by boris mann on January 29, 2009 at 6:50am

No problems. And, in fact, you don't event need to change the base_url. The base_url only needs to be set in certain circumstances -- usually when you've got something about your system that isn't set correctly (e.g. some shared hosting setups).

I don't believe that is

Posted by redndahead on January 29, 2009 at 11:05pm

I don't believe that is entirely true. You will also have to update the files table. This will contain information from your old files directory. If you have a custom favicon.ico file then that may need to be changed also. One of the best fixes for this if your using drupal 6 or when d7 comes around is this patch from crell that let's you create a sites.php file. This file let's you point a site to a certain sites folder. Allowing you to not have to rename the site folder. This has been a life saver for my sites.

http://drupal.org/node/231298

Files and favicon?

Posted by no2e on January 30, 2009 at 12:13am

You will also have to update the files table. This will contain information from your old files directory.

This is only needed if I uploaded files? Or do I have to update the database, too, although no files were uploaded?
And is this process of updating easy (without any problems?) possible via phpmyadmin? Never dit something like that before.

If you have a custom favicon.ico file then that may need to be changed also.

You mean the "Path to custom icon" at admin/build/themes/settings, correct?

One of the best fixes for this if your using drupal 6 or when d7 comes around is this patch from crell that let's you create a sites.php file. This file let's you point a site to a certain sites folder. Allowing you to not have to rename the site folder. This has been a life saver for my sites.

http://drupal.org/node/231298

Hmm, I don't like to use a patch for Drupal, to be honest. Does this patch only fix the above mentioned problems? So: files and favicon? Or does it more for this case?

Ah, btw:
what about internal links in content? When I linked node relatively, there won't be any problems, correct?
So <a href="/node/2">click here</a> instead of <a href="http://example.com/node/2">click here</a>, correct? Or should I use other methods? (can remember vague, that I read of a module for this purpose ...)

As long as you use relative

Posted by redndahead on January 30, 2009 at 1:57am

As long as you use relative you should be fine. As far as uploads if you use cck's file field you will run into this also. It's not insurmountable, but it will require you to go into the database and inside the files table replace your old sites folder with your new sites folder. And yes path to custom icon if you keep the custom icon in your files folder.

Thanks!

Posted by no2e on January 29, 2009 at 11:06pm

Thanks Boris Mann,
I'm relieved to hear that - and now have plenty opportunitys to update all my static websites without pressure :)

And, in fact, you don't event need to change the base_url. The base_url only needs to be set in certain circumstances -- usually when you've got something about your system that isn't set correctly (e.g. some shared hosting setups).

Ah, I see. But it might not have any negative effect, if I set it (and it wouldn't be needed)? Never tried a multi-site without this setting, though.

a little late, but still might be helpful

Posted by eporama on January 16, 2010 at 7:00pm

If you create your dev site as: dev.foobar.example.com, you can use sites/foobar.example.com as your sites folder. Since your static web site is being pulled from a directory other than Drupal, it won't care.

Then all you have to do is repoint your foobar.example.com config to your drupal root and it will automatically still use the same sites/foobar.example.com folder.

If you haven't hardcoded any images or links with "http://dev.foobar.example.com", you should be all set. File uploads, theme icons, etc. should all be found just fine.

Thanks eporama

Posted by no2e on January 16, 2010 at 8:26pm

Ah, nice tip -- thanks eporama!
Using a sub-subdomain wasn't something I thought of. I'll consider this.

I also found a module (didn't test it, yet):
http://drupal.org/project/sitedir_migrate

Nice module

Posted by jumoke on March 8, 2011 at 5:20am

That is an amazing module..the sitedir_migrate. saved me some time!! whew

heads up: major changes in drupal 7.x

Posted by donSchoe on December 21, 2011 at 4:45pm

if you come across this site and you want to know if you can change the domains or directories, the solution is pretty simple: check out the /sites/sites.php

i couldn't find any official documantation yet, have a look at my brainstorming-wiki: http://qhor.net/wiki/Drupal:Multisite

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /