无法使用路由从 Codeigniter 中的 url 中删除子文件夹目录

Cannot able to remove the subfolder directory from url in Codeigniter using routing

我在 Controller 中有以下目录结构:

Controllers
  |__ posts
      |__ post.php

views
  |__ welcome_message.php
  |__ home.php

welcome_message.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Welcome to CodeIgniter</title>
</head>
<body>
  <a href="<?php echo site_url("posts/post/posts_controller"); ?>">link</a>
</body>
</html>

home.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Welcome to CodeIgniter Link Page</title>
</head>
<body>

<div id="container">
    <h1>This is the link page</h1>

<div id="body">
    <p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
</div>
</div>

</body>
</html>

welcome.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

       public function __construct()
    {
        parent::__construct();
        $this->load->helper('url');
    }

    public function index()
    {
        $this->load->view('welcome_message');
    }
}

post.php

<?php

Class Post extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->helper('url');
    }

    public function posts_controller()
    {
        $this->load->view('home');
    }

}
?>

当我在 welcome_message.php 中单击 link 时,我得到了关注 url http://localhost/url_routing/posts/post/posts_controller 但我想从 url 中删除帖子(即文件夹名称)所以我在 routes.php 文件夹中尝试 $route['posts'] = "post/posts_controller"; 但结果是一样的。所以请帮我解决我的问题,如果可能的话给我一个小的解释,我已经从 Whosebug 看到其他答案但不能完全理解。

$route['post/posts_controller'] = 'posts/post/posts_controller';