There is a way to resolve this by .htaccess
and laravel
. And an extra gambiarra that I'll teach you (maybe it's the easiest way).
HTACCESS
A of htaccess
consists of writing the following code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/$1
LARAVEL
You will have to move the file public/index.php
to the root, or just ./index.php
.
Example:
//index.php (agora fora da pasta public)
//require_once __DIR__ . '/../bootstrap/start.php'
require_once __DIR__ . '/bootstrap/start.php'
After that, you'll have to change the way index.php
and bootstrap/paths.php
files are being used by the require
function (you'll have to get the /../
string at the beginning).
Gambiarra Extra (Powered By Wallace)
You can simply create a index.php
file in the root and include the file that is within public/index.php
.
As follows:
//index.php
require __DIR__ . '/public/index.php';
Of the three methods, I would recommend htaccess
.