different domains same directory - codebase

191 views Asked by At

I create a dynamic website with php. This website must work with 5 different databases and 5 domain names, but same codebase. When someone access a domain of these 5, the website understand which domain user access and call the appropriate database. To see which domain user access, i will use a code like this.

Now, what is the best solution to have 5 domains with one same codebase-directory? I use cpanel if that helps.

Any help? Thank you in adavance!

Edit: The solution i find is to create addon domains or parked domains via cpanel pointing to the same directory. After that i will use $_SERVER['SERVER_NAME']; to find which domain visitor use and call the appropriate database.

1

There are 1 answers

0
Alex Vandyke On

The solution is to create addon domains via cpanel pointing to the same directory. After that you will use $_SERVER['SERVER_NAME'] to find which domain visitor use and after that call the appropriate database.