Skip to content

Commit aa37a14

Browse files
committed
docs: add about "auto routes"
1 parent 545837d commit aa37a14

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

user_guide_src/source/incoming/routing.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,29 @@ URI Routing
66
:local:
77
:depth: 2
88

9+
******************************
10+
Auto Routes and Defined Routes
11+
******************************
12+
13+
Auto Routes
14+
===========
15+
916
Typically there is a one-to-one relationship between a URL string and its corresponding
1017
controller class/method. The segments in a URI normally follow this pattern::
1118

1219
example.com/class/method/id/
1320

21+
We call this "**Auto Routes**". CodeIgniter automatically routes a HTTP request,
22+
and executes the corresponding controller method. The auto-routing is enabled by default.
23+
24+
.. note:: To prevent misconfiguration and miscoding, we recommend that you disable
25+
the auto-routing feature. See :ref:`use-defined-routes-only`.
26+
27+
.. important:: The auto-routing routes a HTTP request with **any** HTTP method to a controller method.
28+
29+
Defined Routes
30+
==============
31+
1432
In some instances, however, you may want to remap this relationship so that a different
1533
class/method can be called instead of the one corresponding to the URL.
1634

@@ -23,9 +41,10 @@ For example, let’s say you want your URLs to have this prototype::
2341

2442
Normally the second segment of the URL path is reserved for the method name, but in the example
2543
above it instead has a product ID. To overcome this, CodeIgniter allows you to remap the URI handler.
44+
We call this "**Defined Routes**".
2645

2746
******************************
28-
Setting your own routing rules
47+
Setting Your Own Routing Rules
2948
******************************
3049

3150
Routing rules are defined in the **app/Config/Routes.php** file. In it you'll see that

0 commit comments

Comments
 (0)