This occurred because you did not check if the folder exists and another detail instead:
RewriteRule ^painel - [L]
Prefer this:
RewriteRule ^painel/ - [L]
Without the bar the .htaccess will accept addresses as localhost/painel2
and assuming it is a route it will become inaccessible.
Returning to the problem, you probably did something similar to this in your .htaccess: link
First solution
You should be using something like this:
/home
|--- /user
|--- /public_html
|--- .htaccess (seu .htaccess)
|--- /public
|--- index.php
|--- .htaccess
|--- /app
|--- /bootstrap
|--- /config
|--- /database
|--- /painel (pasta do painel)
If you want the panel folder here to be accessible, public_html/.htaccess
should look like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/ [L]
Second Solution
However, the best thing is that everything is inside public
itself, so the structure would be that of the folders being this ( public_html
is a common folder in servers, may have another name like www
), the location of the folder panel into public
:
/home
|--- /user
|--- /public_html
|--- .htaccess (seu .htaccess)
|--- /public
|--- /painel (pasta do painel)
|--- index.php
|--- .htaccess
|--- /app
|--- /bootstrap
|--- /config
|--- /database
Then in this case the file public_html/.htaccess
must contain:
RewriteEngine On
RewriteRule ^ public/ [L]
And the public_html/public/.htaccess
file should contain:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Third solution
But I have to say one thing, you can even use .htaccess to point everything to public
, however the best way is to set DocumentRoot
to be public
of Laravel or else drop public
in public_html
and the laravel folders will be out, something like:
/home
|--- /user
|--- /app
|--- /bootstrap
|--- /config
|--- /database
|--- public_html (conteúdo de public deve ficar nesta pasta)
|--- /painel (pasta do painel)
|--- index.php
|--- .htaccess