Page 1 of 1
Can two domains access the same database?
Posted: Mon Oct 09, 2006 3:44 pm
by sioux
I have two different domains hosted on the same server.
I have installed cmsms on both domains - one installation contains all the website's pages which have been added through the admin panel.
The other domain currently has no pages on it as I would like to be able to access the same information by using the same database i.e identical content on two websites
When setting up cmsms on the second domain I used all the information for the existing database in the setup page.
It doesn't work. Is it possible that it can work and I've done something silly, or is there no way that one database can serve two domains?
Re: Can two domains access the same database?
Posted: Mon Oct 09, 2006 3:56 pm
by Dee
It should be very well possible. To achieve that MySQL must be configured to allow access to the database from the other domain (probably from another host than localhost).
Hmm, if the domains are on the same server setting 'localhost' as db server should work.
When you setup cmsms on the second domain you ran install/install.php and entered the same db info as for the first domain?
Did the install script accept that (were you able to complete the installation? the script checks validity of the values entered)?
Re: Can two domains access the same database?
Posted: Mon Oct 09, 2006 4:29 pm
by sioux
Yes I did, but when I clicked on the 'visit your new site' link I got the error message - 'Not Found - The requested url was not found on this server' - that's why I wondered if it wasn't possible to do this after all.
Re: Can two domains access the same database?
Posted: Tue Oct 10, 2006 6:11 pm
by Pierre M.
"two different domains" + "hosted on the same server" + "identical content on two websites"
=> you only need one CMS to manage the content (and of course only one db).
You "just need" to tune the multihosting feature of your *webserver* so that
www.d1.net and
www.d2.org BOTH point to the same /opt/cmsms installation directory.
PM
Re: Can two domains access the same database?
Posted: Tue Oct 10, 2006 6:50 pm
by sioux
Hi Pierre,
Thanks for the reply - I'm thrilled to know it can be done.
As a bit of a dimwit with anything too technical, is there an easy way to do that?
I use WHM and Cpanel and can't find any mention of a multi-hosting feature

Re: Can two domains access the same database?
Posted: Tue Oct 10, 2006 7:36 pm
by Dr.CSS
If it is going to be exact as in 2 domains pointing to the same site your hosting provider should be able to help you with this, I have three domains registered with one hosting company and if you go to my main site you get it, if you type in my other domain name it atuo redirects you to the main site, this was the default setup, I actually had to point my third domain to another folder with CMSMS installed.
Re: Can two domains access the same database?
Posted: Tue Oct 10, 2006 8:41 pm
by sioux
Hi Mark,
I've used redirects so when you type in
www.domainA.com you go to
www.domainB.com but I was hoping that it would appear that the pages would belong to that site e.g.
www.domainA.com/sitemap.html would be the same page as
www.domainB.com/sitemap.html even though the different urls would appear in the address bar.
Is that what you meant?
Thanks,
Sue
Re: Can two domains access the same database?
Posted: Tue Oct 10, 2006 9:00 pm
by Dr.CSS
Yep that's it, example... and I didn't have to do any redirects...
http://multiintech.com/
http://multipleintegratedtechnologies.com/
now you see why I use MultiInTech instead of the full name, it's short for Multiple Integrated Technologies...

Re: Can two domains access the same database?
Posted: Tue Oct 10, 2006 9:35 pm
by sioux
Hmmm - I think I must be at cross purposes with youÂ
If I go to
http://www.multiintech.com/index.php?pa ... greyshadow (for example) and then go to the same page on the
www.multipleintegratedtechnologies.com (phew you're right - that's long!), the url bar still shows
http://www.multiintech.com/index.php?pa ... greyshadow not
http://www.multipleintegratedtechnologi ... greyshadow
if you see what I mean? That's what I hoped to achieve - the same page but with a url related to the website it's accessed from.
Is that possible?
Re: Can two domains access the same database?
Posted: Wed Oct 11, 2006 1:40 pm
by Pierre M.
Hello,
as Marks has said, your hosting provider can help.
I don't know what "WHM and Cpanel" are, so I can't speak about it.
You own your domains via your registrar. Then your DNS provider tells surfers what host (IP) are
www.d1.net and
www.d2.org and these may be the same. And this unique host is multihosting requests (webserver) for both domains. If your DNS provider is your hosting provider, sure it can help you.
If you have to tune the webserver yourself, read its documentation. Here are some untested examples I'm not sure about :
lighttpd.net :
$HTTP["host"] == "
www.d1.net" { server.document-root = "/path/to/cmsms/inst/" }
$HTTP["host"] == "
www.d2.org" { server.document-root = "/path/to/cmsms/inst/" }
apache :
http://httpd.apache.org/docs/2.2/vhosts/examples.html
PM
Re: Can two domains access the same database?
Posted: Wed Oct 18, 2006 7:47 pm
by jameshontishar
Hi not sure if this helps but
I have installed cmsms at Domain A
I have a SQL database at an ip address ie 222.222.222.222
The tables are in the preset cms_
I have now installed cmsms at domain B
I have pointed it at the ipaddress ie 222.222.222.222
The tables are in the preset cms_ and then make sure you untick the box to create tables otherwise you will delete you existing site.
I find its best practice to always change the preset cms_ to something relevent like WEBNAME_ so you don't accidently delete them
This method can also be used to host two different domains from the same sql database just make sure you change the preset cms_ to something different
Hope This Helps
Re: Can two domains access the same database?
Posted: Wed Oct 18, 2006 10:37 pm
by tsw
be warned. doing content editing on both sites simultaneously will break things...