===================================================================
CONFIGURAÇÃO DE VIRTUALHOST WILDCARD - Systhema ERP
===================================================================

PASSO 1: Habilitar mod_rewrite
===================================================================

1. Abra: C:\xampp\apache\conf\httpd.conf

2. Procure e descomente (remova o #):
   #LoadModule rewrite_module modules/mod_rewrite.so

   Deve ficar:
   LoadModule rewrite_module modules/mod_rewrite.so

3. Procure e descomente:
   #LoadModule vhost_alias_module modules/mod_vhost_alias.so

   Deve ficar:
   LoadModule vhost_alias_module modules/mod_vhost_alias.so

4. No final do arquivo, procure e descomente:
   #Include conf/extra/httpd-vhosts.conf

   Deve ficar:
   Include conf/extra/httpd-vhosts.conf

===================================================================
PASSO 2: Configurar VirtualHost com Wildcard
===================================================================

1. Abra: C:\xampp\apache\conf\extra\httpd-vhosts.conf

2. APAGUE TODO O CONTEÚDO e cole:

---INÍCIO DO ARQUIVO---

# VirtualHost Wildcard para Systhema Multi-tenant
<VirtualHost *:80>
    ServerName Systhema.local
    ServerAlias *.Systhema.local
    DocumentRoot "C:/xampp/htdocs/Systhema"

    <Directory "C:/xampp/htdocs/Systhema">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog "logs/Systhema-error.log"
    CustomLog "logs/Systhema-access.log" common
</VirtualHost>

---FIM DO ARQUIVO---

===================================================================
PASSO 3: Configurar DNS Local (Arquivo hosts)
===================================================================

1. Abra como ADMINISTRADOR:
   C:\Windows\System32\drivers\etc\hosts

2. Adicione estas linhas no FINAL do arquivo:

# Systhema ERP Multi-tenant
127.0.0.1 Systhema.local
127.0.0.1 gaelsystem.Systhema.local
127.0.0.1 conegundes.Systhema.local
127.0.0.1 conegundes1.Systhema.local
127.0.0.1 conegundes2.Systhema.local

Nota: Adicione uma linha para cada subdomínio que criar

===================================================================
PASSO 4: Reiniciar Apache
===================================================================

1. Abra o XAMPP Control Panel
2. Clique em "Stop" no Apache
3. Clique em "Start" no Apache

===================================================================
PASSO 5: Testar
===================================================================

Acesse no navegador:

http://Systhema.local/
http://gaelsystem.Systhema.local/login

===================================================================
TROUBLESHOOTING
===================================================================

Problema: Não abre nada
Solução: Verifique se adicionou .local no final do domínio

Problema: Erro 403
Solução: Verifique as permissões da pasta Systhema

Problema: Página em branco
Solução: Verifique os logs em: C:\xampp\apache\logs\Systhema-error.log

===================================================================

