Serve Kabano from site root instead of /public
Co-authored-by: LeOSW42 <673670+LeOSW42@users.noreply.github.com>
This commit is contained in:
6
.htaccess
Normal file
6
.htaccess
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
RewriteRule ^public(/.*)?$ - [L]
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteRule ^(.*)$ public/$1 [L]
|
||||||
@@ -8,3 +8,5 @@
|
|||||||
- `Controllers/` : contrôleurs MVC backend (ancien `controllers/`)
|
- `Controllers/` : contrôleurs MVC backend (ancien `controllers/`)
|
||||||
- `Models/` : modèles MVC backend (ancien `models/`)
|
- `Models/` : modèles MVC backend (ancien `models/`)
|
||||||
- `Thirds/` : dépendances tierces backend (ancien `third/`)
|
- `Thirds/` : dépendances tierces backend (ancien `third/`)
|
||||||
|
|
||||||
|
Note: configure the web server at the repository root; requests to `/` are routed to `public/` via `.htaccess`.
|
||||||
|
|||||||
@@ -19,12 +19,15 @@ $config['public_folder'] = $config['abs_root_folder']."public/";
|
|||||||
// This is the relative folder to the root of the website from the DocumentRoot (can also be called subfolder)
|
// This is the relative folder to the root of the website from the DocumentRoot (can also be called subfolder)
|
||||||
$document_root = rtrim(realpath($_SERVER['DOCUMENT_ROOT']), DIRECTORY_SEPARATOR);
|
$document_root = rtrim(realpath($_SERVER['DOCUMENT_ROOT']), DIRECTORY_SEPARATOR);
|
||||||
$public_root = rtrim(realpath($config['public_folder']), DIRECTORY_SEPARATOR);
|
$public_root = rtrim(realpath($config['public_folder']), DIRECTORY_SEPARATOR);
|
||||||
|
$abs_root = rtrim(realpath($config['abs_root_folder']), DIRECTORY_SEPARATOR);
|
||||||
$config['rel_root_folder'] = "";
|
$config['rel_root_folder'] = "";
|
||||||
if ($document_root && $public_root && strpos($public_root, $document_root) === 0) {
|
if ($document_root && $abs_root && $document_root === $abs_root) {
|
||||||
|
$config['rel_root_folder'] = "/";
|
||||||
|
} elseif ($document_root && $public_root && strpos($public_root, $document_root) === 0) {
|
||||||
$config['rel_root_folder'] = substr($public_root, strlen($document_root));
|
$config['rel_root_folder'] = substr($public_root, strlen($document_root));
|
||||||
}
|
}
|
||||||
$config['web_root_folder']="https://kabano.test/";
|
$config['web_root_folder']="https://kabano.test/";
|
||||||
if($config['rel_root_folder']=="") {
|
if($config['rel_root_folder']=="" || $config['rel_root_folder']=="/") {
|
||||||
$config['rel_root_folder']="/";
|
$config['rel_root_folder']="/";
|
||||||
} else {
|
} else {
|
||||||
$config['rel_root_folder'] = "/".trim($config['rel_root_folder'],"/")."/";
|
$config['rel_root_folder'] = "/".trim($config['rel_root_folder'],"/")."/";
|
||||||
|
|||||||
Reference in New Issue
Block a user