Url 当我点击 link 时发生变化

Url is change when I am click to the link

我正在使用 Codeigniter 4,我在单击菜单时遇到问题 Url 正在更改

我的控制器是

<?php namespace App\Controllers;

class Pages extends BaseController
{
    public function index($page='Home')
    {

        if(!is_file(APPPATH.'/views/pages/'.$page.'.php')){
                    die;
                    throw new \CodeIgniter\Exceptions\PageNotFoundException($page);
                }

                return view("pages/{$page}");
    }
        public function about($page='About')
    {

        if(!is_file(APPPATH.'/views/pages/'.$page.'.php')){
                    die;
                    throw new \CodeIgniter\Exceptions\PageNotFoundException($page);
                }

                return view("pages/{$page}");
    }

         public function contact($page='Contact')
    {

        if(!is_file(APPPATH.'/views/pages/'.$page.'.php')){
                    die;
                    throw new \CodeIgniter\Exceptions\PageNotFoundException($page);
                }

                return view("pages/{$page}");
    }

}

我的路线页面

$routes->get(':/', 'Pages::index');
$routes->get(':/', 'Pages::about');
$routes->get(':/', 'Pages::contact');

并且html是

   <ul class="nav navbar-nav">
            <li class="active"><a href="pages/">Home</a></li>
            <li><a href="pages/about">About</a></li>
            <li><a href="pages/contact">Contact</a></li>
          </ul>

最初它会工作正常但是当我再次点击菜单时它的 url 改变 http://localhost/pages/contact to like this url http://localhost/pages/pages/contact 我不知道我哪里错了请建议我

改为绝对路径

<ul class="nav navbar-nav">
    <li class="active"><a href="/pages/">Home</a></li>
    <li><a href="/pages/about">About</a></li>
    <li><a href="/pages/contact">Contact</a></li>
</ul>