Jump to content

Multiple domains. Single Application.


leon_nerd

Recommended Posts

Hello,

 

I have been working on an architecture for quite some time and one problem that I have not been able to find a suitable solution is being mentioned here.

 

I have multiple domains but they all have to run using a single application. For example www.123.com, www.456.com, www.abc.com, all of these applications are going to use a single set of application files. My problem is:

 

Whenever the user types in a domain name say www.123.com, it will be redirected to the central application. Now, this application is stored in an other folder. So, the URL will change. So, if I type in like www.123.com/home.php then it will access the home.php in the application folder and will change the URL to something like www.centralapplication.com/home.php. I want to keep the URL same. I don't want the URL to change. So, the user should be able to use the applicaiton as www.123.com/ rather than www.centralapplication.com/

 

Now, I have been researching on this issue. Someone suggested me to keep all the files in a folder and write APIs that I will place in each domain folder. So, whenever a user types in a site name the APIs stored in its folder will access the files from the application folder. I am not sure how this will work. Any idea?

 

Another approach suggested was to use $_SERVER['HTTP_HOST'] to determine which site it is, and get the request through $_SERVER['REQUEST_URI']. So if we make the request http://www.example.com/user/login then you'll have:

HTTP_HOST = www.example.com

REQUEST_URI = /user/login

 

I am not sure how this approach works.

 

So, can you please help me out in deciding the best solution for this problem. I really don't have much idea about this since I am doing it for first time.

 

Thanks a lot in advance.

Link to comment
Share on other sites

So would http://www.abc.com/home.php and http://www.centralapplication.com/home.php be the exact same page? If that's the case you just need to set them up as addon domains through your hosting provider.

 

If you're familiar M-V-C you might see something like this:

 

http://www.domain.com/controller/action

 

However you might want to have:

 

http://www.someotherdomain.com/action essentially "point to" http://www.domain.com/controller/action

 

Is this the same scenario you're talking about?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.