I have a system where there will be multiple users. Each user will have their own subdomain. Ex.:
usuario1.sistema.com.br
usuario2.sistema.com.br
For this I created the subdirectories and in each of them I created a .htaccess by redirecting to the system that is in the root folder. See:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cliente1.sistema.com.br$ [OR]
RewriteCond %{HTTP_HOST} ^www.cliente1.sistema.com.br$
RewriteRule ^(.*)$ http://www.sistema.com.br/acesso/$1 [P]
The problem is that when it creates this redirect for the system, I can not identify who the client is, ie whether it is client1 or client2 , etc.
How could I do to identify this customer? I do not have much experience with .htaccess , but I believe I could use RewriteCond %{QUERY_STRING}
and in the system file get PHP with $_REQUEST
. Something like:
RewriteCond %{QUERY_STRING}^cliente=cliente1
And in PHP:
$cliente = $_REQUEST["cliente"];
If this is the solution, how would I apply the RewriteCond %{QUERY_STRING}
to my .htaccess ?