Gunjan Srivastava
Gunjan Srivastava

Reputation: 41

Using one site for multiple domain in PHP

I have one site completely working for one client , now I have some more clients want same thing replicated for them , Is there any way , that I can use this site as base site , as I plan to access this site from there domain and providing database for each client.

I am using PHP and MYSQL. Thanks for any support , I appreciate your point of view also in this process. do I have right approach

I have been told that there will be SEO issues if I use one site for multiple domain. I have no competent person available which can direct me on domain name linking. I have www.xyzuniversity.com and 85% data is fetching from database. now i have to create abcuniversity.com and I want that I just create new database and ready to use and I think I can make multiple sites like this , if I succeed

Thanks

Upvotes: 3

Views: 1128

Answers (2)

hakre
hakre

Reputation: 198204

Put the shared code into a shared directory and give each domain it's own database configuration, so the database configuration is not shared.

Then start your application with the different configuration based on the domain, e.g. by server environment variables like the hostname.

If your design does not support a configuration that can be injected into the application, you need to maintain two code-bases, one for each domain, e.g. in source-code control with one branch per domain.

However I suggest that your code is that modular that it supports configuration for the parts that need configuration according to your needs. If it's not yet, think about coming closer to it and make the changes.

Upvotes: 1

smp7d
smp7d

Reputation: 5032

You can point multiple domains to the site. You can get the domain name from the server vars ($_SERVER['HTTP_HOST']) and choose you database through that. Make sure you dont have any absolute links.

Upvotes: 6

Related Questions