redirect /blog to /blog/

This commit is contained in:
Diego Najar 2018-12-26 19:17:30 +01:00
parent 74b68e507a
commit be5a8ad517
2 changed files with 9 additions and 1 deletions

View File

@ -5,6 +5,14 @@ if ($url->uri()==HTML_PATH_ROOT.ADMIN_URI_FILTER) {
Redirect::url(DOMAIN_ADMIN);
}
// Redirect blog, from /blog to /blog/
// This rule only works when the user set a page as homepage
if ($url->uri()==HTML_PATH_ROOT.'blog' && $site->homepage()) {
$filter = $url->filters('blog');
$finalURL = Text::addSlashes(DOMAIN_BASE.$filter, false, true);
Redirect::url($finalURL);
}
// Redirect pages, from /my-page/ to /my-page
if ($url->whereAmI()=='page' && !$url->notFound()) {
$pageKey = $url->slug();

View File

@ -355,7 +355,7 @@ class Site extends dbJSON {
public function homepage()
{
$homepage = $this->getField('homepage');
if( empty($homepage) ) {
if (empty($homepage)) {
return false;
}
return $homepage;