Trong file settings.php của website1.com
<?php
$db_url = 'mysql://username:password@localhost/db_website1';
$db_prefix = array(
'default' => 'w1_',
'users' => 'db_share.',
'users_roles' => 'db_share.',
'sessions' => 'db_share.',
'role' => 'db_share.',
'authmap' => 'db_share.',
);
?>
Trong file settings.php của websiten.com
<?php
$db_url = 'mysql://username:password@localhost/db_websiten';
$db_prefix = array(
'default' => 'wn_',
'users' => 'db_share.',
'users_roles' => 'db_share.',
'sessions' => 'db_share.',
'role' => 'db_share.',
'authmap' => 'db_share.',
);
?>
Ví dụ với một site có đường dẫn như sau: http://www.drupal.org/mysite/test/ thì độ ưu tiên trong thư mục sites sẽ là:
1. sites/www.drupal.org.mysite.test
2. sites/drupal.org.mysite.test
3. sites/org.mysite.test
4. sites/www.drupal.org.mysite
5. sites/drupal.org.mysite
6. sites/org.mysite
7. sites/www.drupal.org
8. sites/drupal.org
9. sites/org
10. sites/default
Độ ưu tiên được sắp xếp từ 1 -> 10, nghĩa là khi truy cập vào đường dẫn http://www.drupal.org/mysite/test/ thì hệ thống Drupal sẽ tìm file thông tin cấu hình của site đó theo ưu tiên từ 1 là thư mục sites/www.drupal.org.mysite.test nếu không có thì bỏ qua và tiếp tới các thư mục ưu tiên khác. Nếu có dừng lại đọc thông tin cấu hình trong thư mục đó.
Thanks anh Sỹ
Đọc được new theme qua twitter của anh vào xem lại gặp được bài tut multisite của anh ^^.
Anh cho em hỏi thêm là một website bình thường mình chỉ cần config được subdomain là thực hiện multisite với drupal phải không anh?
Thử dùng multi-site với sites
Thử dùng multi-site với sites + context + purl chưa, cái đó cũng hay lắm, dù là đang phát triển.
@trunghaily: Cái subdomain
@trunghaily:
- Cái subdomain trỏ về IP chứa hosting.
- Còn trong thư mục site thì đặt tên của site theo thứ tự ưu tiên:
1. sites/www.drupal.org.mysite.test
2. sites/drupal.org.mysite.test
3. sites/org.mysite.test
4. sites/www.drupal.org.mysite
5. sites/drupal.org.mysite
6. sites/org.mysite
7. sites/www.drupal.org
8. sites/drupal.org
9. sites/org
10. sites/default
@Bao:
Để dùng thử xem sao
PS: Hiên tại hai website
PS: Hiên tại hai website www.sanglt.com và www.nguyentiensi.com đang chạy multi-site
Em xin nick Yahoo CHAT của anh nào biết làm vấn đề này ạ
Nick CHAT yahoo của em là hotro_hbco
Anh nào làm được điều này rồi add nick của em vào cho em học hỏi với ạ
Nếu được thì liên hệ hòm thư dangky@bonghongvang.vn cho em thông tin em sẽ gọi hoặc email liên hệ lại. Em đang làm cái này mã làm mãi chưa được. Hiện em quản lý 20 site khác nhau nên cần cái này lắm.
Add your comment