Skip to content

Custom routing rule not match the User Guide #1609

Description

@nyufeng

Describe the bug
https://codeigniter4.github.io/CodeIgniter4/incoming/routing.html

$routes->add('blog/joe', 'Blogs::users/34');

A URL containing the segments “blog/joe” will be remapped to the “Blogs” class and the “users” method. The ID will be set to “34”:

But actually the method is users/34

visit page show 404

CodeIgniter 4 version
version 4.0.0-alpha.3

Affected module(s)
Routes

Expected behavior, and steps to reproduce if appropriate
In application/Config/Routes.php set:

$routes->add('blog/joe', 'Blogs::users/34');

In application/Controllers/Blogs.php set:

<?php namespace App\Controllers;

use CodeIgniter\Controller;

class Blogs extends Controller
{
    public function users($id){
        echo $id;
    }
}

visit /blog/joe and /blogs/users/34 should show
snipaste_2018-12-14_15-28-41
but visit /blog/joe show
snipaste_2018-12-14_15-28-27

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions