I have the following file structure (example):
/usuarios
/admin
.htaccess
I successfully managed to set up .htaccess so that when I access the url below, everyone is directed to the users folder, and displays the url as typed, not displaying the folder domain.com.br/users/ p>
fulano.dominio.com.br
ciclano.dominio.com.br
etc.dominio.com.br
I used the following code
RewriteCond %{HTTP_HOST} ^(.*)\.dominio\.com\.br
RewriteCond %{REQUEST_URI} !^/usuarios
RewriteRule ^(.*)$ /usuarios/$1 [L,NC]
In this case, any subdomain of the url will be directed to the users folder, and it will display the url without the folder, keeping the correct link with subdomain (ex: so.domain.com).
Now my question ...
I need to create an exception when accessing
leandro.dominio.com.br
admin.dominio.com.br
I want the target folder to be "admin", ie I need to create exceptions and keep the function from being redirected to the folder without changing the url
My attempt (I do not know much about htaccess)
RewriteCond %{HTTP_HOST} ^leandro\.dominio\.com\.br
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule ^(.*)$ /admin/$1 [L,NC]
RewriteCond %{HTTP_HOST} ^(.*)\.dominio\.com\.br
RewriteCond %{REQUEST_URI} !^/usuarios
RewriteRule ^(.*)$ /usuarios/$1 [L,NC]
In this case, when accessing so-and-so.com works, the content of the "users" folder is displayed, but when trying to access leandro, error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
What is the correct syntax for .htaccess for this case?
I thank you for any attempt to help