Direct with htaccess without changing the url

Asked

Viewed 197 times

2

Colleagues.

I have a system that is inside the following directory. www.site.com.br/crm/system/ I would like that when typing www.site.com.br/crm, it was directed to the system folder, but without changing the url, continuing www.site.com.br/crm. I have the following code below, but it’s 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]

1 answer

3


put a file . htaccess in the folder "crm": http://www.site.com.br/crm/

Like the code below:

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

And inside the folder "system", put another file . htaccess, 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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.