Skip to content

Commit d6b8bb1

Browse files
authored
Merge pull request #6963 from kenjis/fix-docs-auto-routing
docs: update auto routing notes
2 parents a0554f3 + a6d1385 commit d6b8bb1

10 files changed

Lines changed: 23 additions & 23 deletions

File tree

user_guide_src/source/cli/cli_controllers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ works exactly like a normal route definition:
4141

4242
For more information, see the :ref:`Routes <command-line-only-routes>` page.
4343

44-
.. warning:: If you enable :ref:`auto-routing` and place the command file in **app/Controllers**,
45-
anyone could access the command with the help of auto-routing via HTTP.
44+
.. warning:: If you enable :ref:`auto-routing-legacy` and place the command file in **app/Controllers**,
45+
anyone could access the command with the help of :ref:`auto-routing-legacy` via HTTP.
4646

4747
Run via CLI
4848
===========

user_guide_src/source/incoming/controllers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ your **app/Config/Routes.php** file.
313313

314314
CodeIgniter also permits you to map your URIs using its :ref:`Defined Route Routing <defined-route-routing>`..
315315

316-
.. _controller-auto-routing:
316+
.. _controller-auto-routing-legacy:
317317

318318
Auto Routing (Legacy)
319319
*********************

user_guide_src/source/incoming/filters.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ This file contains four properties that allow you to configure exactly when the
7171

7272
.. Warning:: It is recommended that you should always add ``*`` at the end of a URI in the filter settings.
7373
Because a controller method might be accessible by different URLs than you think.
74-
For example, when auto-routing is enabled, if you have ``Blog::index``,
74+
For example, when :ref:`auto-routing-legacy` is enabled, if you have ``Blog::index``,
7575
it can be accessible with ``blog``, ``blog/index``, and ``blog/index/1``, etc.
7676

7777
$aliases
@@ -127,8 +127,8 @@ specify the method name in lowercase. It's value would be an array of filters to
127127
In addition to the standard HTTP methods, this also supports one special case: 'cli'. The 'cli' method would apply to
128128
all requests that were run from the command line.
129129

130-
.. Warning:: If you use ``$methods`` filters, you should :ref:`disable auto-routing <use-defined-routes-only>`
131-
because auto-routing permits any HTTP method to access a controller.
130+
.. Warning:: If you use ``$methods`` filters, you should :ref:`disable Auto Routing (Legacy) <use-defined-routes-only>`
131+
because :ref:`auto-routing-legacy` permits any HTTP method to access a controller.
132132
Accessing the controller with a method you don't expect could bypass the filter.
133133

134134
$filters

user_guide_src/source/incoming/routing.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ available from the command line:
361361
.. note:: It is recommended to use Spark Commands for CLI scripts instead of calling controllers via CLI.
362362
See the :doc:`../cli/cli_commands` page for detailed information.
363363

364-
.. warning:: If you enable :ref:`auto-routing` and place the command file in **app/Controllers**,
365-
anyone could access the command with the help of auto-routing via HTTP.
364+
.. warning:: If you enable :ref:`auto-routing-legacy` and place the command file in **app/Controllers**,
365+
anyone could access the command with the help of Auto Routing (Legacy) via HTTP.
366366

367367
Global Options
368368
==============
@@ -386,8 +386,8 @@ The value for the filter can be a string or an array of strings:
386386
See :doc:`Controller filters <filters>` for more information on setting up filters.
387387

388388
.. Warning:: If you set filters to routes in **app/Config/Routes.php**
389-
(not in **app/Config/Filters.php**), it is recommended to disable auto-routing.
390-
When auto-routing is enabled, it may be possible that a controller can be accessed
389+
(not in **app/Config/Filters.php**), it is recommended to disable Auto Routing (Legacy).
390+
When :ref:`auto-routing-legacy` is enabled, it may be possible that a controller can be accessed
391391
via a different URL than the configured route,
392392
in which case the filter you specified to the route will not be applied.
393393
See :ref:`use-defined-routes-only` to disable auto-routing.
@@ -668,7 +668,7 @@ In this example, if the user were to visit **example.com/products**, and a ``Pro
668668
.. note:: You cannot access the controller with the URI of the default method name.
669669
In the example above, you can access **example.com/products**, but if you access **example.com/products/listall**, it will be not found.
670670

671-
.. _auto-routing:
671+
.. _auto-routing-legacy:
672672

673673
Auto Routing (Legacy)
674674
*********************
@@ -712,7 +712,7 @@ Consider this URI::
712712
In the above example, CodeIgniter would attempt to find a controller named **Helloworld.php**
713713
and executes ``index()`` method with passing ``'1'`` as the first argument.
714714

715-
See :ref:`Auto Routing (Legacy) in Controllers <controller-auto-routing>` for more info.
715+
See :ref:`Auto Routing (Legacy) in Controllers <controller-auto-routing-legacy>` for more info.
716716

717717
Configuration Options (Legacy)
718718
==============================
@@ -732,7 +732,7 @@ The default controller is also used when no matching route has been found, and t
732732
in the controllers directory. For example, if the user visits **example.com/admin**, if a controller was found at
733733
**app/Controllers/Admin/Home.php**, it would be used.
734734

735-
See :ref:`Auto Routing in Controllers <controller-auto-routing>` for more info.
735+
See :ref:`Auto Routing (Legacy) in Controllers <controller-auto-routing-legacy>` for more info.
736736

737737
Default Method (Legacy)
738738
-----------------------

user_guide_src/source/installation/upgrade_415.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ If you want the same behavior as the previous version, set the CSRF filter like
5656

5757
Protecting **GET** method needs only when you use ``form_open()`` auto-generation of CSRF field.
5858

59-
.. Warning:: In general, if you use ``$methods`` filters, you should :ref:`disable auto-routing <use-defined-routes-only>`
60-
because auto-routing permits any HTTP method to access a controller.
59+
.. Warning:: In general, if you use ``$methods`` filters, you should :ref:`disable Auto Routing (Legacy) <use-defined-routes-only>`
60+
because :ref:`auto-routing-legacy` permits any HTTP method to access a controller.
6161
Accessing the controller with a method you don't expect could bypass the filter.
6262

6363
CURLRequest header change

user_guide_src/source/installation/upgrade_4xx.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Application Structure
5858
Routing
5959
=======
6060

61-
- The Auto Routing is disabled by default. If you want to use the Auto Routing in the same way as CI3, you need to enable :ref:`auto-routing`.
61+
- The Auto Routing is disabled by default. If you want to use the Auto Routing in the same way as CI3, you need to enable :ref:`auto-routing-legacy`.
6262
- CI4 also has an optional new more secure :ref:`auto-routing-improved`.
6363

6464
Model, View and Controller

user_guide_src/source/installation/upgrade_routing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ What has been changed
2121
Upgrade Guide
2222
=============
2323

24-
1. If you use the Auto Routing in the same way as CI3, you need to enable :ref:`auto-routing`.
24+
1. If you use the Auto Routing in the same way as CI3, you need to enable :ref:`auto-routing-legacy`.
2525
2. The placeholder ``(:any)`` in CI3 will be ``(:segment)`` in CI4.
2626
3. You have to change the syntax of each routing line and append it in **app/Config/Routes.php**. For example:
2727

user_guide_src/source/libraries/security.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ It is also possible to enable the CSRF filter only for specific methods:
147147

148148
.. literalinclude:: security/009.php
149149

150-
.. Warning:: If you use ``$methods`` filters, you should :ref:`disable auto-routing <use-defined-routes-only>`
151-
because auto-routing permits any HTTP method to access a controller.
150+
.. Warning:: If you use ``$methods`` filters, you should :ref:`disable Auto Routing (Legacy) <use-defined-routes-only>`
151+
because :ref:`auto-routing-legacy` permits any HTTP method to access a controller.
152152
Accessing the controller with a method you don't expect could bypass the filter.
153153

154154
HTML Forms

user_guide_src/source/libraries/throttler.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ Next, we assign it to all POST requests made on the site:
7373

7474
.. literalinclude:: throttler/004.php
7575

76-
.. Warning:: If you use ``$methods`` filters, you should :ref:`disable auto-routing <use-defined-routes-only>`
77-
because auto-routing permits any HTTP method to access a controller.
76+
.. Warning:: If you use ``$methods`` filters, you should :ref:`disable Auto Routing (Legacy) <use-defined-routes-only>`
77+
because :ref:`auto-routing-legacy` permits any HTTP method to access a controller.
7878
Accessing the controller with a method you don't expect could bypass the filter.
7979

8080
And that's all there is to it. Now all POST requests made on the site will have to be rate limited.

user_guide_src/source/tutorial/create_news_items.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Open the **app/Config/Filters.php** file and update the ``$methods`` property li
2222
It configures the CSRF filter to be enabled for all **POST** requests.
2323
You can read more about the CSRF protection in :doc:`Security </libraries/security>` library.
2424

25-
.. Warning:: In general, if you use ``$methods`` filters, you should :ref:`disable Auto Routing (Legacy) <use-defined-routes-only>`
26-
because :ref:`auto-routing` permits any HTTP method to access a controller.
25+
.. Warning:: In general, if you use ``$methods`` filters, you should :ref:`disable Auto Routing (Legacy) <use-defined-routes-only>`
26+
because :ref:`auto-routing-legacy` permits any HTTP method to access a controller.
2727
Accessing the controller with a method you don't expect could bypass the filter.
2828

2929
Create a Form

0 commit comments

Comments
 (0)