aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-08-09 22:01:47 +0200
committerThomas Lange <code@nerdmind.de>2021-08-09 22:05:06 +0200
commit4dee76debb3857f69be701710f3aac2d7feb799c (patch)
tree62dab36e0b4ff5a1c448bd6a97e1ad6eb047a707 /index.php
parent71ce4376699100af7f9263f96913a6497c4ad566 (diff)
downloadblog-4dee76debb3857f69be701710f3aac2d7feb799c.tar.gz
blog-4dee76debb3857f69be701710f3aac2d7feb799c.tar.xz
blog-4dee76debb3857f69be701710f3aac2d7feb799c.zip
Merge regex pattern for search and feed controller
Diffstat (limited to 'index.php')
-rw-r--r--index.php22
1 files changed, 5 insertions, 17 deletions
diff --git a/index.php b/index.php
index a7d0ce6..8f34047 100644
--- a/index.php
+++ b/index.php
@@ -33,28 +33,16 @@ Router::add('', function() {
});
#===============================================================================
-# ROUTE: Feed
+# ROUTE: Feed and Search
#===============================================================================
-Router::add('feed/', function() {
- require 'core/include/feed/main.php';
+Router::add('(feed|search)/', function($slug) {
+ require "core/include/{$slug}/main.php";
});
#===============================================================================
-# ROUTE: Search
+# REDIRECT: Feed and Search (trailing slash)
#===============================================================================
-Router::add('search/', function() {
- require 'core/include/search/main.php';
-});
-
-#===============================================================================
-# REDIRECT: Feed (trailing slash)
-#===============================================================================
-Router::addRedirect('feed', Application::getURL('feed/'));
-
-#===============================================================================
-# REDIRECT: Search (trailing slash)
-#===============================================================================
-Router::addRedirect('search', Application::getURL('search/'));
+Router::addRedirect('(feed|search)', Application::getURL('$1/'));
#===============================================================================
# REDIRECT: Favicon