Routing defines how URLs are mapped to controllers and methods. In CodeIgniter 4, routing is powerful, flexible, and easy to configure.
Routes are defined in:
URL:
URL:
URL:
Set in Routes.php:
Useful for organizing routes.
URL:
Generate URL:
Allows:
⚠️ Security Risk – better to define routes manually.
Apply filters like authentication.
Or group filter:
Automatically creates CRUD routes.
Creates:
GET /users
POST /users
GET /users/{id}
PUT /users/{id}
DELETE /users/{id}
Routes map URLs → Controllers
Defined in app/Config/Routes.php
Supports parameters, groups, filters, REST APIs
Avoid auto-routing in production
Take quizzes related to this topic and see where you stand!
Start Quiz Now