0

It seems to me that the idea behind laravel is that the public/ directory is where your DocumentRoot points to and that the app/, vendor/, bootstrap/ and build/ directories all live outside the web root. But what happens if you want the laravel project to live in a subdirectory.

ie. http://www.domain.tld/ might be static HTML, http://www.domain.tld/phpbb/ is phpBB and you wanted your laravel app to live at http://www.domain.tld/app/.

Should you just put the entire laravel folder in http://www.domain.tld/app/ and redirect, via .htaccess, all requests to http://www.domain.tld/app/public/? That seems inelegant.

Maybe you could put laravel in http://www.domain.tld/ and rename the /public/ directory to /app/ but that seems even more inelegant.

Any ideas?

jrenk
  • 1,387
  • 3
  • 24
  • 46
neubert
  • 15,947
  • 24
  • 120
  • 212

2 Answers2

0

The question is why you need it in subdirectory. So far I never need to put custom project into subdirectory. I use domain or subdomain if needed.

You could try with:

  • renaming your public directory to the directory name you want to use
  • put other directories into your root domain directory
  • add .htaccess for those directories with deny from all (to block access from your root domain)
  • edit paths in bootstrap/paths.php

I haven't tested it and I wouldn't probably even try to do that. Many frameworks are rather created to use them on separate domains or subdomains and not in directories so I would recommend you to rethink it.

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
0

Use virtual hosts in your web engine (eg. apache, nginx, IIS, etc.) and point the document root for your alias to your laravel app.

Tala
  • 909
  • 10
  • 29