Drop the "index" part of URLs

Closes #347. Thanks @Robby-
This commit is contained in:
Daniel Rudolf 2016-04-23 21:40:30 +02:00
parent a119122497
commit 1b3ef7516d
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538

View file

@ -1387,9 +1387,18 @@ class Pico
. (is_object($queryData) ? get_class($queryData) : gettype($queryData)) . ' given'
);
}
// drop "index"
if ($page === 'index') {
$page = '';
} elseif (($pagePathLength = strrpos($page, '/')) !== false) {
if (substr($page, $pagePathLength + 1) === 'index') {
$page = substr($page, 0, $pagePathLength);
}
}
if (!empty($queryData)) {
$page = !empty($page) ? $page : 'index';
$queryData = $this->isUrlRewritingEnabled() ? '?' . $queryData : '&' . $queryData;
$queryData = ($this->isUrlRewritingEnabled() || empty($page)) ? '?' . $queryData : '&' . $queryData;
}
if (empty($page)) {