Skip to content

Commit

Permalink
Another try
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Mar 27, 2024
1 parent 47bd0b9 commit 2836214
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions router.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php

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

// Emulate Apache's `mod_rewrite` functionality
if ($uri !== '/' && file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . $uri)) {
if ($uri !== '/' && file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . ltrim($uri, '/'))) {
return false;
}

Expand Down

0 comments on commit 2836214

Please sign in to comment.