title: Custom Profile URL Codeigniter
body: <p>I'm trying to create the custom profile url like site/u/username
  i found this one <a href="https://stackoverflow.com/questions/19336567/how-to-make-url-username-in-codeigniter">How to make url /username in codeigniter?</a></p>
  
  <p>but until now it still show 404. when i'm trying to access site/u/username</p>
  
  <p><strong>my routes.php</strong></p>
  
  <pre><code>$route['default_controller'] = "guest";
  $route['404_override'] = 'u';
  </code></pre>
  
  <p><strong>my model</strong></p>
  
  <pre><code>   function cekuser($username)
     {
      $query = $this-&gt;db-&gt;query("SELECT * FROM usertable WHERE username = '$username'");
          $query = $query-&gt;result_array();
          if($query){
              return $query[0];
          };
     }
  </code></pre>
  
  <p><strong>my controller</strong></p>
  
  <pre><code>&lt;?php class U extends CI_Controller {
      public function __construct() {
              parent::__construct(); 
      }
  
      public function index()
      {
          $username = $this-&gt;uri-&gt;segment(1);
  
          if (empty($username)) {
              $this-&gt;show_404();
          }
  
          $this-&gt;load-&gt;model('m_login');
  
          // Check if parameter is not a valid username.
          if (!$this-&gt;m_login-&gt;cekuser($username)) {
              $this-&gt;displayPageNotFound();
          } else { 
              $this-&gt;load-&gt;view('template');
          }
      }
  
      protected function displayPageNotFound() {
          $this-&gt;output-&gt;set_status_header('404');
          $this-&gt;load-&gt;view('notfound');
      }
  }
  </code></pre>