-4

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.

Alex Vandyke
  • 73
  • 1
  • 8
  • You are not so friendly. I ask for suggestions. I have the solution but i want some advice from pros. No need to work for me. If you are here to judge the question and you cant help you are free to ignore the question. – Alex Vandyke Sep 12 '17 at 07:03
  • to cite the box next to the form field, when you entered your problem description: "How to Ask. Is your question about programming? We prefer questions that can be answered, not just discussed. Provide details. Share your research." apparently you ignored that box. stackoverflow is for solving specific problems, where you have reached your limit, not for open-ended questions. if you want people rambling about pros and cons, ins and outs, trade-offs and what not, the internet is the place (or another stackexchange site). No offense mate. – Jakumi Sep 12 '17 at 07:12
  • Your second answer is so clear. Thank you for the advice, i'm here to learn. I edit the question with my personal solution. – Alex Vandyke Sep 12 '17 at 07:22

1 Answers1

0

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.

Alex Vandyke
  • 73
  • 1
  • 8