Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7050491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:09:00+00:00 2026-05-28T03:09:00+00:00

I have a controller called user which just loads the user profile page for

  • 0

I have a controller called user which just loads the user profile page for now

class user extends CI_Controller {

    public function __construct(){
        parent::__construct();
    }

    public function index($username = null){
        //load index page
        $this->load->view('profile/index');
    }

}

i have also routed it so i can load it from user/$username in routes

//user profiles pretty url
$route['user/(:any)'] = "user/index/$1";

the thing is i would like to change it and allow directly the users to go to their profiles without typing user/$username and instead $usernamd like mysite.com/$username…

I tried it but it messes up everything.how can i achieve this?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:09:01+00:00Added an answer on May 28, 2026 at 3:09 am

    I guess the only way to achieve something like this is to add all other controllers to your routes file.

    You could try something like this

    $route['controller'] = "controller";
    $route['controller/(:any)'] = "controller/$1";
    $route['(:any)'] = "user/$1";
    

    Combined with the _remap function as stated here. In your users controller.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a controller which has a method called history class UsersController < ApplicationController
I have a controller called articles , which creates the articles model which gets
I have a page. (action) and a controller called Widget. im passing in client
I'll just jump right into it. I have a model called Request which I
I have a controller called EmailController , which is (you guessed it) responsible for
I have a view controller class called PresidentsViewController that sets up data in a
I have a controller called Admin with a number of Actions. In the URL,
I have a controller that is called with AJAX (sends JSON data), so I
I have a news site with articles tagged in categories. My Controller is called
I have a div called test and mvc action in the client controller The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.