You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config/config-files.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,12 @@ This file holds the duration of user session when 'remember me' checkbox is chec
68
68
69
69
This file lets you re-map URI requests to specific controller functions.
70
70
71
-
We generally recommend using [Template Routes](templates/routes.md) and not modify this file, unless you know you need to.
71
+
This is different from Template Routes for templates.
72
+
73
+
- Controller routes (`routes.php`) map requests to controller methods.
74
+
- Template Routes map requests to templates and are documented in [Template Routes](templates/routes.md).
75
+
76
+
If you want to define Template Routes in config, use `$config['routes']` (or `$config['routes:<site_id>']`) in `system/user/config/config.php` and keep [`enable_template_routes`](general/system-configuration-overrides.md#enable_template_routes) enabled.
Copy file name to clipboardExpand all lines: docs/general/system-configuration-overrides.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1393,6 +1393,8 @@ Example Usage:
1393
1393
1394
1394
This setting toggles whether or not Template Routes are used. If this is set to no, templates will not be accessible by their routes. When disabled the Template Route options will not appear in the Template Manager.
1395
1395
1396
+
This setting applies to both Template Routes managed in the Control Panel and config-defined routes in `$config['routes']` / `$config['routes:<site_id>']`. If this is `n`, route matching is disabled.
1397
+
1396
1398
| Value | Behavior |
1397
1399
| ----- | -------------------------------- |
1398
1400
| y | Enable Template Routes (default) |
@@ -1402,6 +1404,8 @@ Example Usage:
1402
1404
1403
1405
$config['enable_template_routes'] = 'y';
1404
1406
1407
+
For config-defined route mappings, see [Template Routes](templates/routes.md#config-defined-routes).
1408
+
1405
1409
## `enable_throttling`
1406
1410
1407
1411
If enabled, the system will throttle excessive web requests from potentially malicious users.
Copy file name to clipboardExpand all lines: docs/templates/routes.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,47 @@ An issue arises if ExpressionEngine parses your routes in the above order when t
39
39
40
40
NOTE: **Important:** Template Routes overrides the default behavior of URLs, if you wish to use a Channel Entries Tag in your template you must manually provide segments for any parameters that are normally set in the URL. You must provide a segment for pagination, categories, and entry titles if you wish to use those in your Channel Entries Tag. Additionally, be careful when using `dynamic="yes"` with Template Routes, this can cause issues if your route does not have an appropriate segment set.
41
41
42
+
## Config-Defined Routes
43
+
44
+
In addition to managing routes in the Control Panel, you can define Template Routes directly in `system/user/config/config.php`.
45
+
46
+
Template Route matching requires [`enable_template_routes`](general/system-configuration-overrides.md#enable_template_routes) to be enabled. This setting defaults to `y`, so you only need to set it if it was previously disabled.
47
+
48
+
$config['enable_template_routes'] = 'y';
49
+
50
+
Define routes as an associative array where:
51
+
52
+
- the key is `template_group/template_name`
53
+
- the value is the route pattern string
54
+
55
+
Example:
56
+
57
+
$config['routes'] = [
58
+
'blog/index' => '/blarg',
59
+
'blog/entry' => '/blarg/{url_title}',
60
+
];
61
+
62
+
Regex rules use the same syntax as any other Template Route rule:
These routes use the same rule engine as routes created in the Template Manager.
70
+
71
+
NOTE: **Note:** When `$config['routes']` is present, the Template Route Manager is not available in the Control Panel. Manage those routes in config as the source of truth.
72
+
73
+
NOTE: **Advanced (MSM):** For site-specific route definitions, use `$config['routes:<site_id>']`. ExpressionEngine checks this key first and falls back to `$config['routes']` if no site-specific routes are defined.
74
+
75
+
$config['routes:1'] = [
76
+
'blog/index' => '/site-one-blog',
77
+
];
78
+
79
+
$config['routes'] = [
80
+
'blog/index' => '/blog',
81
+
];
82
+
42
83
### Template Route
43
84
44
85
This route determines the URLs that will match your template. The format is as follows:
0 commit comments