I have a multiple site install using 1 codebase and many databases by adding sites to the sites folder like this:

sites
--all
--default
--mysite1.com
--mysite2.com
--mysite3.com

This works well.

My question is in this scenario can I also have multiple URLS point to the same site?

For example,

mysite1.com continues to be a seperate site as it is now
mysite2.com, mysiteA.com, and mysiteB.com all direct to mysite2.com
mysite3.com continues to be a seperate site as it is now

Thanks for all the help!

Comments

shadcn’s picture

Yep, you can do this. and it doesnt necessarily depends on the drupal codebase but on your hosting config. Point the required domain name to the correct installed folder

Let me know if this work for you

sifuhall’s picture

many thanks for the reply.

So just for clarification,

Presently:

mysite1.com
mysite2.com
mysite3.com

all point to the document root and because of my sites folder and .htaccess they appear to be different sites.

Now I want mysiteA.com, mysiteB.com, and mysite3.com to point to mysite2.com I should make the URL go to where?

if it is the document root how do I specify to use mysite2.com's database with the shared codebase?

shadcn’s picture

First thing first, to share the codebase, under /sites you should have folders like this /sites/default, /sites/mysite1 , /sites/mysite2, /site/mysite.

Now for each subfolder, we need settings.php and a "files" directory.

To set the database, find the line 92 in the settings.php file and replace $db_url by this for each database connection.

$db_url = 'mysql://[put db_username here]:[password here]@[server here]/[database name here]';

The following comments can help you:

 * Database URL format:
 *   $db_url = 'mysql://username:password@localhost/databasename';
 *   $db_url = 'mysqli://username:password@localhost/databasename';
 *   $db_url = 'pgsql://username:password@localhost/databasename';
 */
sifuhall’s picture

Yep, see my first post in this thread. That's all working fine.

My question (see the first post and third post in this thread) is about how to have multiple URLs point to a single site that is part of a shared codebase.

shadcn’s picture

What you need to do is go to the cpanel on your host, go to domain manager and find the domain u want to point to the folder. lets say u want http://example.com to point to the site mysiteA.com you make it point to sites/mysiteA. Then find the next domain u want to point to the same sime, http://example1.com, make it point to sites/mysiteA also. shud work. i just did this in the morning for a client.

let me know if you made it. i woud be happy to provide my assisstance.

Thanks
Arshad