diff options
author | Thomas Lange <code@nerdmind.de> | 2021-08-09 22:01:47 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-08-09 22:05:06 +0200 |
commit | 4dee76debb3857f69be701710f3aac2d7feb799c (patch) | |
tree | 62dab36e0b4ff5a1c448bd6a97e1ad6eb047a707 | |
parent | 71ce4376699100af7f9263f96913a6497c4ad566 (diff) | |
download | blog-4dee76debb3857f69be701710f3aac2d7feb799c.tar.gz blog-4dee76debb3857f69be701710f3aac2d7feb799c.tar.xz blog-4dee76debb3857f69be701710f3aac2d7feb799c.zip |
Merge regex pattern for search and feed controller
-rw-r--r-- | index.php | 22 |
1 files changed, 5 insertions, 17 deletions
@@ -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 |