Right now I have build a small framework, and I would like to host multiple websites in it. So on every site I would run a DNS to publishserver.mydomain.com where I will then show the corresponding website.
Right now my (my idea for a) directory structure looks like this:
folder Application (All the framework files, Request, Response, Bootstrap etc)
folder Websites (All the websites)
– http://www.domain1.com
– http://www.domain2.com
– http://www.domain3.com
– http://www.domain4.com
.htaccess
index.php (starts the framework)
At every wwww.domain1.com I would then have a structure like this:
folder http://www.domain1.com
– Controllers
– views
– images
– css
What would be the smartest way for me to do this? Originally my idea was (on my test localhost) to do just do localhost/www.domain1.com/home for example, and then to get the files from that domain.
I want it to be accessable on the live server, a test server and my localhost, without having to adjust configuration files. Is this possible, and what would be my best approach?
If you have a database, store pages in a database table with a corresponding site ID. Then, in your index.php file, pick up the host the script is being accessed from, and display the relavant pages based on the site.