From 481fe1903e73d1bc1bc98ec74e4bb1b23a7b3e94 Mon Sep 17 00:00:00 2001 From: Antony Dabonde Date: Wed, 6 Sep 2017 05:58:57 +1000 Subject: [PATCH] Added system option to enable case insensitive urls. (#1638) --- system/blueprints/config/system.yaml | 11 +++++++++++ system/src/Grav/Common/Uri.php | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/system/blueprints/config/system.yaml b/system/blueprints/config/system.yaml index e8bcfd70b..ccfa60a7e 100644 --- a/system/blueprints/config/system.yaml +++ b/system/blueprints/config/system.yaml @@ -1163,6 +1163,17 @@ form: validate: type: bool + case_insensitive_urls: + type: toggle + label: PLUGIN_ADMIN.CASE_INSENSITIVE_URLS + highlight: 0 + help: PLUGIN_ADMIN.CASE_INSENSITIVE_URLS_HELP + options: + 1: PLUGIN_ADMIN.YES + 0: PLUGIN_ADMIN.NO + validate: + type: bool + param_sep: type: select size: medium diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 45daf1a04..eb714897e 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -286,6 +286,11 @@ class Uri $this->url = $this->base . $this->uri; + // if case insensitive urls is enabled, lowercase the url + if( $grav['config']->get('system.case_insensitive_urls') ){ + $this->url = strtolower($this->url); + } + // get any params and remove them $uri = str_replace($this->root, '', $this->url);