Direct with htaccess without changing the url

1

Colleagues.

I have a system that is within the following directory. www.site.com.br/crm/sistema/ I would like that when entering www.site.com.br/crm, be directed to the system folder, but without changing the url, continuing www.site.com.br/crm. I have the following code but it is not working:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?site.com.br/crm$
RewriteCond %{REQUEST_URI} !^/sistema/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /sistema/$1/
RewriteCond %{HTTP_HOST} ^(www.)?site.com.br/crm$
RewriteRule ^(/)?$ sistema/index.php [L]
    
asked by anonymous 01.08.2016 / 22:12

1 answer

1

put a .htaccess file in the "crm" folder: link

Like the code below:

RewriteEngine On
RewriteRule ^crm/(.*)$ ./sistema/$1

And inside the "system" folder, place another .htaccess file, with the rules as in the example below:

RewriteEngine On

RewriteBase /crm/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+[^/])$ $1/ [R,L]

# inicio --------------- suas regras aqui -------------------#

RewriteRule ^index$ index.php
RewriteRule ^home$ index.php
RewriteRule ^exemplo-id-(.*)$ index.php?id=$1
RewriteRule ^pg/(.*)$ index.php?pagina=$1
    
01.08.2016 / 22:26