Hide directory with htaccess

1

Colleagues.

I have the following code in htaccess that I do the targeting:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?site.com.br$
RewriteCond %{REQUEST_URI} !^/novo/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /novo/$1
RewriteCond %{HTTP_HOST} ^(www.)?site.com.br$
RewriteRule ^(/)?$ novo/index.php [L]

However, there are links containing new / company.php and you would like to click only company.php on the click without having to change the menu links. Can you do this in htaccess?

    
asked by anonymous 18.07.2016 / 14:57

1 answer

1

You can use 301 redirect in this case. It would look something like this:

redirect 301 /novo/empresa.php http://www.seusite.com.br/empresa.php

I hope I have helped.

Update
Since it is not a url only, you should make a rule of RewriteEngine
It would look something like this:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+novo/([^\s]+) [NC]
RewriteRule ^ %1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (?!^novo/)^(.*)$ /novo/$1 [L,NC]

Reference: link

You can see that this problem is common in the community:
link
link
link
link
link

I hope I have helped.

    
18.07.2016 / 15:26