Allowing apache to create folders... of dynamics this is the best because internal paths are fixed alone, without impact to php for example...
http://httpd.apache.org/docs/2.2/vhosts/mass.html#simple
But I already used the text file method, it had no graphical interface, to administer, but the client could upload a text file to ftp in which he put the domain and the root folder and apache went up the site in the act, according to the apache site:
RewriteEngine on
RewriteMap lowercase int:tolower
# define the map file
RewriteMap vhost txt:/www/conf/vhost.map
# deal with aliases as above
RewriteCond %{REQUEST_URI} !^/icons/
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
# this does the file-based remap
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/docs/$1
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/cgi-bin/$1
http://httpd.apache.org/docs/2.2/vhosts/mass.html#Xtra-conf
This is an Apache configuration. I don’t see how a system that runs under Apache itself could change a configuration of it. My suggestion would be to keep the domains saved in some bank and use a cron to search for the domains created and create them in Apache settings.
– Rodrigo Rigotti
Can you confirm which web server you are using? As @rodrigorigotti said, the ideal would be to schedule a task that changes the server settings, but how to do this depends on the server used, (and depending on the case, also the operating system).
– bfavaretto
Use cPanel, follow an ss of the server settings: link
– mend3
First you need to have a database with the list of subdomains. Then just create a *wildcard subdomain .dominio.com.br pointing to a file testa_subdominio.php. When the user type meulogin.dominio.com.br, the server calls testa_subdominio.php which connects to the BD and loads the page to login "meulogin" or error 404, if the login does not exist or is invalid.
– user622
If you are using Cpanel, you can use this Cpanel library that allows you to create subdomains by passing PHP parameters. https://github.com/CpanelInc/xmlapi-php
– Júlio Rossato