0
I have the following file structure (example):
/usuarios
/admin
.htaccess
I successfully set up the . htaccess so that, when accessing the url below, all are directed to the users folder, and displays the url as it was typed, and not displaying the domain.com.br/users folder
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 domain of the url, will be directed to the user folder, and displays the url without the folder, keeping the correct link with Domain (eg.).
Now my doubt...
I need to create an exception when accessing
leandro.dominio.com.br
admin.dominio.com.br
I want the destination folder to be "admin", that is, I need to create exceptions and keep the function of being redirected to the folder without changing the url
My attempt (I don’t 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.dominio.com.br works, the contents of the folder "users" is displayed, but when trying to access leandro, error is displayed
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 of mine?
I appreciate any attempt at help