How to install Laravel 4 to a web host subfolder without publicly exposing /app/ folder? -


i wondering if of know of way install laravel 4 in web host subdirectory / subfolder while not exposing /app/ folder , other sensible files publicly accesible part of host.

the idea is, i'd able access http://mydomain.com/mylaravel/ able use laravel, @ same time want avoid doing going http://mydomain.com/app/ or http://mydomain.com/mylaravel/app/ , being able see config files , other code.

so figured out how this. i'll explain example.

suppose domain, http://domain.com. here's example of structure might using:

domain.com/    (the root of web hosting) |-- yourlaravel4_base/ |-- [some other folders...] |-- public_html/    (where html files , such go) |   |-- [some other folders...] |   |-- yourlaravel4/ 

/public_html/ root of publicly accessible part of web hosting files. want create subfolder in /public_html/ (in case /public_html/yourlaravel4/). in subfolder store contents of laravel 4 public/ folder.

now, rest of files. have go root of web hosting files, is, wanna @ domain.com/ level, therefore being able see public_html/ , other folders. then, need create folder here, laravel 4's base files stored. in case, it's domain.com/yourlaravel4_base/. inside yourlaravel4_base/ need store every file , folder exists in base laravel 4 directory. app/, bootstrap/, vendor/, server.php, etc. except /public/ folder, contents stored in public_html/yourlaravel4/.

finally, need edit 2 files: laravel's /bootstrap/paths.php , /public/index.php.


in paths.php file, replace:

'app' => __dir__.'/../app', 

with:

'app' => __dir__.'/../../yourlaravel4_base/app', 

in paths.php file, replace:

'public' => __dir__.'/../public', 

with:

'public' => __dir__, 

in paths.php file, replace:

'base' => __dir__.'/..', 

with:

'base' => __dir__.'/../../yourlaravel4_base', 

in paths.php, replace:

'storage' => __dir__.'/../app/storage', 

with:

'storage' => __dir__.'/../../yourlaravel4_base/app/storage', 

in index.php, replace:

require __dir__.'/../bootstrap/autoload.php'; 

with:

require __dir__.'/../../yourlaravel4_base/bootstrap/autoload.php'; 

in index.php, replace:

$app = require_once __dir__.'/../bootstrap/start.php'; 

with:

$app = require_once __dir__.'/../../yourlaravel4_base/bootstrap/start.php'; 

upload changes. should able have laravel 4 installed in subfolder in website without exposing app/ folder , other sensitive files. :)


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -