Permalink
Browse files

Update .htrouter.php

Making this simulate the .htaccess file a bit closer.
  • Loading branch information...
Ultimater committed Aug 31, 2017
1 parent 2a8a72c commit 8c8faab4ecaf38f0e4f418edb2802d58e9906ac2
Showing with 18 additions and 1 deletion.
  1. +18 −1 .htrouter.php
View
@@ -15,10 +15,27 @@
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
if ($uri !== '/' && file_exists(__DIR__ . $uri)) {
return false;
}
if ($uri !== '/' && file_exists(__DIR__ . '/public' . $uri)) {
header('Location: /public' . $_SERVER['REQUEST_URI'], true, 303);
exit;
}
if (preg_match('#(?:^/core/(?:assets|themes|uploads)(?:$|/|[?]))#', $uri)) {
return false;
}
$_GET['_url'] = $_SERVER['REQUEST_URI'];
if (preg_match('#^/core/modules/[^/]+/assets/#', $uri)) {
return false;
}
if(preg_match('#^/([^/]+)/assets/(.+)#', $uri, $m)) {
header('Location: /core/modules/' . $m[1]. '/assets/'. $m[2], true, 303);
exit;
}
$_GET['_url'] = $_SERVER['REQUEST_URI'];
require_once __DIR__ . '/public/index.php';

0 comments on commit 8c8faab

Please sign in to comment.