Skip to content

Commit

Permalink
Rewrite / to /public
Browse files Browse the repository at this point in the history
  • Loading branch information
ikhsan3adi committed Jul 6, 2024
1 parent 82e5171 commit df91b07
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
22 changes: 22 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]

RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>
4 changes: 0 additions & 4 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@
});
});

Livewire::setUpdateRoute(function ($handle) {
return Route::post('/livewire/update', $handle);
});

Livewire::setScriptRoute(function ($handle) {
return Route::get(url('/livewire/livewire.js'), $handle);
});
11 changes: 11 additions & 0 deletions server.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

if ($uri !== '/' && file_exists(__DIR__ . '/public' . $uri)) {
return false;
}

require_once __DIR__ . '/public/index.php';

0 comments on commit df91b07

Please sign in to comment.