views:

50

answers:

1

Hi,

starting new project where users can register and system will automatically install cms system for users registered domain and need to solve dynamic setting of the server (apache).

Registration information and info about the associations between domains and actual paths to the cms installation on the server will be stored in Mysql database.

Is there an easy way to configure apache to connect for all unknown domains to a specific php script, which will look into the database and provide the actual path to the relevant cms - apache will than use this info to correctly handle the request?

I think, that "easier" solution might be to use PHP to write the domains/paths/config to a file and force apache to use this file to handle requests - however as I expect, that the number of the domains might be higher and case that some domain will be deleted will not be rare - the file might become full of unwanted rules soon and hard to optimize, also apache restart would be needed in order to use changed file etc..therefore the question about dynamic solution - that might be much easier to manage (for me and for the admin system itself).

A: 

Yes - use a wildcard vhost in apache, and mod_rewrite to direct all URLs to your front controller (or use the 404 document handler).

C.

symcbean
using 404 handlers for virtual URLs is bad practice in my eyes. I would stick to mod_rewrite (it has its own backwards though)
Dercsár