leon_nerd Posted April 9, 2009 Share Posted April 9, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/153333-multiple-domains-single-application/ Share on other sites More sharing options...
dbo Posted April 10, 2009 Share Posted April 10, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/153333-multiple-domains-single-application/#findComment-806042 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.