Skip to content

Commit

Permalink
Support installation in subdirectory with Apache
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMicky-FR committed Aug 7, 2022
1 parent 15e477b commit 1f9238b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /public/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]

# Handle assets in the public/ directory
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
Expand All @@ -19,5 +20,5 @@
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
RewriteRule ^ server.php [L]
</IfModule>
19 changes: 19 additions & 0 deletions server.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* Laravel - A PHP Framework For Web Artisans.
*
* @author Taylor Otwell <[email protected]>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}

require_once __DIR__.'/index.php';

0 comments on commit 1f9238b

Please sign in to comment.