Hide URL folder [duplicate]

0

I am having trouble adapting this code, my site is in a folder called site I want to hide this folder and leave everything if it was in the root, until then it works, the problem is when I go to the 'admin' folder when I error 404 logo, can someone help me

RewriteEngine ON
RewriteBase /

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

RewriteRule ^(.*)\/(.*)\/(.*)\/(.*)\.html$ index.php?module=$1&page=$2&section=$3&ss=$4&url_rewrite [QSA,L]
RewriteRule ^(.*)\/(.*)\/(.*)\.html$ index.php?module=$1&page=$2&section=$3&url_rewrite [QSA,L]

RewriteRule ^(.*)\/(.*)\.html$ index.php?module=$1&page=$2&url_rewrite [QSA,L]

RewriteRule ^([a-zA-Z]+)?(\/)$ index.php?module=$1&url_rewrite [QSA,L]

php_value upload_max_filesize 32M
php_value post_max_size 32M
    
asked by anonymous 22.01.2016 / 21:07

1 answer

0
Method A

If you want to prevent the 'skeleton' from the site folder from being displayed when accessing the folder directly by the URL ( meusite.com/site ), as in this example below:

/site
    • imagens
    • js
    • css
       • meusEstilos.css

simply add a index.html or a index.php file into this folder and add a dummy content to that file. For example:

index.html

<head></head>
<body>
    <h3>Nothing to see here</h3>
</body>
Method B

If you would like to use htaccess instead to redirect the traffic destined for the site folder to a page 404 for example, you can do it like this:

RedirectMatch 404 ^/site/.*$

or

RedirectMatch 301 ^/site/ http://www.meusite.com/?

If you want to redirect traffic to the homepage or to a specific page.

    
23.01.2016 / 03:28