Skip to content

Instantly share code, notes, and snippets.

@iksi
Created November 3, 2017 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iksi/466baefca807c08921218eddb29a12ba to your computer and use it in GitHub Desktop.
Save iksi/466baefca807c08921218eddb29a12ba to your computer and use it in GitHub Desktop.
server.php for kirby
<?php
// removes querystrings
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if (file_exists($_SERVER['DOCUMENT_ROOT'] . $path)) return false;
// what the .htaccess would normally do
if (preg_match('/^\/panel\/(.*)/', $path)) {
$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR . 'panel' . DIRECTORY_SEPARATOR . 'index.php';
} else {
$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR . 'index.php';
}
require_once $_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment