-2
I have a system where there will be multiple users. Each user will have his own subdomain. Ex.:
usuario1.sistema.com.br
usuario2.sistema.com.br
For this I created the subdirectories and in each of them I created one .htaccess redirecting to the system 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 to the system, I cannot identify who the client is, ie if it is the cliente1 or cliente2, etc..
How could I identify this customer? I don’t have much experience with .htaccess, but I believe I could use RewriteCond %{QUERY_STRING}
and in the system file take the PHP with $_REQUEST
. Something like:
RewriteCond %{QUERY_STRING}^cliente=cliente1
And in PHP:
$cliente = $_REQUEST["cliente"];
If that’s the solution, how would I apply the RewriteCond %{QUERY_STRING}
in my .htaccess?
Hello Rafael. Thank you for the reply, but in case instead of the name be cliente1, cliente2, is the real name of the customer. Ex.: fernandopessoa.sistema.com.br, carloschagas.sistema.com.br,... How would I do? I’m sorry, I put cliente1, cliente2, as an example.
– user24136
The person who downvoted my answer, could justify what the problem is? Once I pasted the report of the test that proves the functioning!
– Rafael Salomão
Perfect Rafael. It worked! Thank you very much!
– user24136
Not at all my King!
– Rafael Salomão