How do I create automatic subdomains from a form?

7

I am developing a large system, which already serves almost 30 companies in the state and a few more are to join.

The system is accessed by companies from this url:

  • meudomínio.com.br / empresa1
  • meudomínio.com.br / empresa2
  • meudomínio.com.br / empresa3

I would like to know how to do the "automatic subdomain" that is type here:

Enter the company name and it will be able to access the system from company1.mystery.com

    
asked by anonymous 17.02.2014 / 20:09

1 answer

2

Allowing apache to create folders ... of the dynamic ones this is the best because the internal paths are fixed alone, without impact to php for example ... link

But I already used the text file method, there was no graphical interface to manage, but the client could upload a text file in the ftp in which he placed the subdomain and the root folder and apache uploaded the site in the act, according to the apache website:

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

link

    
17.02.2014 / 20:30