darwinel | d8bef8a | 2014-02-11 20:13:22 +0100 | [diff] [blame] | 1 | <?php |
darwinel | d8bef8a | 2014-02-11 20:13:22 +0100 | [diff] [blame] | 2 | defined('BASEPATH') OR exit('No direct script access allowed'); |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 3 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 4 | /* |
| 5 | | ------------------------------------------------------------------------- |
| 6 | | URI ROUTING |
| 7 | | ------------------------------------------------------------------------- |
| 8 | | This file lets you re-map URI requests to specific controller functions. |
| 9 | | |
| 10 | | Typically there is a one-to-one relationship between a URL string |
| 11 | | and its corresponding controller class/method. The segments in a |
| 12 | | URL normally follow this pattern: |
| 13 | | |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 14 | | example.com/class/method/id/ |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 15 | | |
| 16 | | In some instances, however, you may want to remap this relationship |
| 17 | | so that a different class/function is called than the one |
| 18 | | corresponding to the URL. |
| 19 | | |
| 20 | | Please see the user guide for complete details: |
| 21 | | |
Andrey Andreev | bd202c9 | 2016-01-11 12:50:18 +0200 | [diff] [blame] | 22 | | https://codeigniter.com/user_guide/general/routing.html |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 23 | | |
| 24 | | ------------------------------------------------------------------------- |
| 25 | | RESERVED ROUTES |
| 26 | | ------------------------------------------------------------------------- |
| 27 | | |
Andrey Andreev | 08fec7b | 2013-07-19 16:25:51 +0300 | [diff] [blame] | 28 | | There are three reserved routes: |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 29 | | |
| 30 | | $route['default_controller'] = 'welcome'; |
| 31 | | |
| 32 | | This route indicates which controller class should be loaded if the |
| 33 | | URI contains no data. In the above example, the "welcome" class |
| 34 | | would be loaded. |
Phil Sturgeon | 23174a6 | 2010-12-15 15:18:16 +0000 | [diff] [blame] | 35 | | |
| 36 | | $route['404_override'] = 'errors/page_missing'; |
| 37 | | |
Andrey Andreev | 51b7acd | 2012-10-29 16:23:13 +0200 | [diff] [blame] | 38 | | This route will tell the Router which controller/method to use if those |
| 39 | | provided in the URL cannot be matched to a valid route. |
Phil Sturgeon | 23174a6 | 2010-12-15 15:18:16 +0000 | [diff] [blame] | 40 | | |
Andrey Andreev | 08fec7b | 2013-07-19 16:25:51 +0300 | [diff] [blame] | 41 | | $route['translate_uri_dashes'] = FALSE; |
| 42 | | |
| 43 | | This is not exactly a route, but allows you to automatically route |
| 44 | | controller and method names that contain dashes. '-' isn't a valid |
| 45 | | class or method name character, so it requires translation. |
| 46 | | When you set this option to TRUE, it will replace ALL dashes in the |
| 47 | | controller and method URI segments. |
| 48 | | |
| 49 | | Examples: my-controller/index -> my_controller/index |
| 50 | | my-controller/my-method -> my_controller/my_method |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 51 | */ |
Luigi Santivetti | 57a98ca | 2020-10-13 22:55:51 +0100 | [diff] [blame^] | 52 | /* Requested URI is empty */ |
| 53 | $route['default_controller'] = 'pelican/public_root'; |
Luigi Santivetti | 7bab494 | 2019-06-16 07:40:53 +0000 | [diff] [blame] | 54 | |
Luigi Santivetti | 57a98ca | 2020-10-13 22:55:51 +0100 | [diff] [blame^] | 55 | $route['^archive$'] = 'pelican/public_root/archives'; |
| 56 | $route['^(author|a)$'] = 'pelican/public_root/authors'; |
| 57 | $route['^(blog|b)$'] = 'pelican/public_root/blog'; |
| 58 | $route['^(category|c)$'] = 'pelican/public_root/categories'; |
| 59 | $route['^gitles$'] = 'pelican/public_gitles'; |
| 60 | $route['^(home|h)$'] = 'pelican/public_root/index'; |
| 61 | $route['^(/|index|i)$'] = 'pelican/public_root/index'; |
| 62 | $route['^(tag|t)$'] = 'pelican/public_root/tags'; |
Luigi Santivetti | 7bab494 | 2019-06-16 07:40:53 +0000 | [diff] [blame] | 63 | |
Luigi Santivetti | 57a98ca | 2020-10-13 22:55:51 +0100 | [diff] [blame^] | 64 | $route['^(author|a)/(.+)'] = 'pelican/public_author/$2'; |
| 65 | $route['(blog|b)/(.+)'] = 'pelican/public_blog/$2'; |
| 66 | $route['^(category|c)/(.+)'] = 'pelican/public_category/$2'; |
| 67 | $route['^(draft|d)/(.+)'] = 'pelican/public_draft/$2'; |
Luigi Santivetti | 7bab494 | 2019-06-16 07:40:53 +0000 | [diff] [blame] | 68 | |
Luigi Santivetti | 57a98ca | 2020-10-13 22:55:51 +0100 | [diff] [blame^] | 69 | $route['(^about$|page/about)'] = 'pelican/public_page/about'; |
| 70 | $route['(^ftp$|page/ftp)'] = 'pelican/public_page/ftp'; |
| 71 | $route['(^git$|page/git)'] = 'pelican/public_page/git'; |
Luigi Santivetti | 7bab494 | 2019-06-16 07:40:53 +0000 | [diff] [blame] | 72 | $route['(^invite$|page/invite)'] = 'invite/view/invite'; |
Luigi Santivetti | 57a98ca | 2020-10-13 22:55:51 +0100 | [diff] [blame^] | 73 | $route['(^mail$|page/mail)'] = 'pelican/public_page/mail'; |
Luigi Santivetti | 7bab494 | 2019-06-16 07:40:53 +0000 | [diff] [blame] | 74 | |
Phil Sturgeon | 23174a6 | 2010-12-15 15:18:16 +0000 | [diff] [blame] | 75 | $route['404_override'] = ''; |
Andrey Andreev | 08fec7b | 2013-07-19 16:25:51 +0300 | [diff] [blame] | 76 | $route['translate_uri_dashes'] = FALSE; |