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: user_guide_src/source/incoming/controllers.rst
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -456,12 +456,17 @@ Your method will be passed URI segments 3 and 4 (``'sandals'`` and ``'123'``):
456
456
457
457
.. literalinclude:: controllers/014.php
458
458
459
-
Defining a Default Controller
460
-
=============================
459
+
Default Controller (Legacy)
460
+
===========================
461
461
462
-
CodeIgniter can be told to load a default controller when a URI is not
463
-
present, as will be the case when only your site root URL is requested. Let's try it
464
-
with the ``Helloworld`` controller.
462
+
The Default Controller is a special controller that is used when a URI end with
463
+
a directory name or when a URI is not present, as will be the case when only your
464
+
site root URL is requested.
465
+
466
+
Defining a Default Controller (Legacy)
467
+
--------------------------------------
468
+
469
+
Let's try it with the ``Helloworld`` controller.
465
470
466
471
To specify a default controller open your **app/Config/Routes.php**
467
472
file and set this variable:
@@ -480,7 +485,7 @@ see the "Hello World" message.
480
485
.. note:: The line ``$routes->get('/', 'Home::index');`` is an optimization that you will want to use in a "real-world" app. But for demonstration purposes we don't want to use that feature. ``$routes->get()`` is explained in :doc:`URI Routing <routing>`
481
486
482
487
For more information, please refer to the :ref:`routes-configuration-options` section of the
0 commit comments