Hi guys,
I would like to do the following thing, but I can not figure out how to do it:
I am developing an application which has many users. Each user has their own separated MySQL database. I’d like to setup Apache virtual hosts, and every vhost serve HTML files from the same directory, but every user have to connect to their own database.
Serving HTML files for every vhosts from the same directory is easy, not problem, I set the DocumentRoot in every vhosts to the same location.
The problem is somehow redirecting requests of dmxConnect/modules/Connections/myconnection.php which should contain different database location for each users/vhosts.
for eg.:
App HTML files are under https://core-app.mydomain.com
User1 subdomain is https://user1-app.mydomain.com
- HTML files served from https://core-app.mydomain.com folder
- Database should be served from db_user1
User2 subdomain is https://user2-app.mydomain.com
- HTML files served from https://core-app.mydomain.com folder
- Database should be served from db_user2
User3 subdomain is https://user3-app.mydomain.com
- HTML files served from https://core-app.mydomain.com folder
- Database should be served from db_user3
Sounds a little bit complicated, but I hope you can understand what I mean
I have tried to place a different “myconnection.php” to User1, User2, User3 subdomain folders and write “Alias dmxConnect/modules/Connections/myconnection.php /var/www/user1/myconnection.php”, but it was unsuccessful.
thanks,
Attila