-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.

3
  • 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. Commented Sep 12, 2017 at 7: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. Commented Sep 12, 2017 at 7: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. Commented Sep 12, 2017 at 7:22

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.