Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
CodeIgniter

Routing in CodeIgniter

Map URLs to controller methods using Routes.php in CodeIgniter 4.

Routing in CodeIgniter — a practical guide to CodeIgniter routing with clear examples you can reuse in real projects.

CodeIgniter Tutorial Series (11/74). Prefer one article? Read the complete CodeIgniter tutorial.

Short description

Define routes in `app/Config/Routes.php`. You can use placeholders, groups, and named routes for clean URLs.

Basic routes

$routes->get('/', 'Home::index');
$routes->get('about', 'Pages::about');
$routes->get('posts/(:num)', 'Posts::show/$1');
$routes->post('contact', 'Contact::submit');

Leave a reply

Your email address will not be published. Required fields are marked *