php - Setting the DocumentRoot in Laravel -


i wanting host multiple laravel projects subfolders within domain, 1 project laravel code base reside @ somedomain.com/project1 , project @ somedomain.com/project2, , on.

is there way tell laravel document root in subfolder of top level directory of domain rather top level directory itself?

i had setup each project 2nd level domain each having it's own documentroot config in apache virtualhost directives (such project1.somedomain.com & project2.somedomain.com), want switch using subdirectories , have 1 top level directory apache docroot , individual projects subfolders.

what best way this?

yes possible. there few howevers though.

first off, you'd put laravel's public directory webserver's document root. in case you'd rename public directory name of subfolders.

you need ensure laravel code (i.e. not public) level public folder (so keep code away possible access). you'll want put 2 separate apps in own folders too. change paths in index.php , paths.php file make sure each application points @ right supporting code.

you'll end this:

  • /path/to/docroot-parent/
    • app1/
      • app/
      • bootstrap/
        • paths.php ('public' => __dir__.'/../../actualdocroot/app1')
      • ...
    • app2/
      • app/
      • bootstrap/
        • paths.php ('public' => __dir__.'/../../actualdocroot/app2')
      • ...
    • actualdocroot/ ← webserver points here docroot
      • app1/
        • css/
        • js/
        • index.php (points ../../app1/bootstrap/autoload.php , ../../app1/bootstrap/start.php)
      • app2/
        • css/
        • js/
        • index.php (points ../../app2/bootstrap/autoload.php , ../../app2/bootstrap/start.php)

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -