Skip to content

Commit a0422d1

Browse files
committed
Allow public folder to be specified for more flexible hosting
1 parent 135ec37 commit a0422d1

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

application/Config/Paths.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,18 @@ class Paths
6161
* system directories.
6262
*/
6363
public $testsDirectory = '../tests';
64+
65+
/*
66+
* ---------------------------------------------------------------
67+
* PUBLIC DIRECTORY NAME
68+
* ---------------------------------------------------------------
69+
*
70+
* This variable must contain the name of the directory that
71+
* contains the main index.php front-controller. By default,
72+
* this is the `public` directory, but some hosts may not
73+
* be able to map a primary domain to a sub-directory so you
74+
* can change this to `public_html`, for example, to comply
75+
* with your host's needs.
76+
*/
77+
public $publicDirectory = 'public';
6478
}

system/bootstrap.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@
4646
* so they are available in the config files that are loaded.
4747
*/
4848

49+
$public = trim($paths->publicDirectory, '/');
50+
4951
// Path to code root folder (just up from public)
50-
$pos = strrpos(FCPATH, 'public'.DIRECTORY_SEPARATOR);
51-
define('ROOTPATH', substr_replace(FCPATH, '', $pos, strlen('public'.DIRECTORY_SEPARATOR)));
52+
$pos = strrpos(FCPATH, $public.DIRECTORY_SEPARATOR);
53+
define('ROOTPATH', substr_replace(FCPATH, '', $pos, strlen($public.DIRECTORY_SEPARATOR)));
5254

5355
// The path to the "application" folder
5456
define('APPPATH', realpath($paths->applicationDirectory).DIRECTORY_SEPARATOR);

0 commit comments

Comments
 (0)