Hi! I have a CRM that is already published. Now I want to sell it on subscription basis. I want to clone the same application as soon as a new client registers and pay the fee. For that I need a sub domain automatically through code and the virtual host too. Not through the CPanel. I will just copy the current application and the database it is using for every new client and he/she will access it through a sub domain which will be named after their username. Help will be appreciated greatly. Thanks!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there @deevannaveed,
If you have a cPanel server, then what you could do is use the cPanel/WHM API to create new accounts for your new users. It will look like this:
You can take a look at the documentation here:
If you don’t have cPanel what you could do is to have a template of a and then update the details in there. For example, your Vhost template could look like this:
Then you could just substitute the
DOMAIN_NAMEpart with the domain name of the specific user. If you are planning to do it with a shell script you could use the
Then you can copy that Vhost into the
Then to enable the Vhost you could do something like this:
Hope that this helps! Regards, Bobby