Skip to content

Instantly share code, notes, and snippets.

@brunoleles
Last active April 6, 2017 16:26
Show Gist options
  • Save brunoleles/6789d433c91f4ca406303a1801565b53 to your computer and use it in GitHub Desktop.
Save brunoleles/6789d433c91f4ca406303a1801565b53 to your computer and use it in GitHub Desktop.
Run Lumen On Sub Folder

How to run Lumen on sub folder

Add this lines after the initialization of the $app variable on public/index.php file.

$SCRIPT_NAME = str_replace(['\\', '/index.php'], ['/', ''], array_get($_SERVER, 'SCRIPT_NAME', array_get($_SERVER, 'PHP_SELF', '')));
$_SERVER['REQUEST_URI'] = preg_replace('|' . $SCRIPT_NAME . '|', '', $_SERVER['REQUEST_URI'], 1);

That's it. 😎

Tested on Ubuntu+Apache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment