Probably, there are tons of results in google and stackoverflow. But unfortunately I could not get anything to work so far.
What I have -- http://localhost/profile/user/userA/12345
What I want -- http://localhost/profile/user/userA
in the URL
Conditions
http://localhost/profile/user/userA
The result of the page is being displayed with data provided by the last segment i.e 12345, in the query
Short of using .htaccess
to rewrite the URL (which I am not sure would be possible and personally would not want to attempt) there isn't a way to pass data via URI segments and hide those segments in the browser address line.
Codeigniter's routing isn't going to help. URI Routing does not change the displayed URL. That isn't what it is for and actually it's just the opposite.
Routing is for reinterpreting the URL to call a different controller and, optionally, method and, optionally, argument segments. The arguments must still be provided however and will still be displayed in the browser's address line.
You can use session storage. Before you are redirecting to this page http://localhost/profile/user/userA
save 12345 in session.
$this->session->set_userdata('id',12345);
you can retrieve this by
$id = $this->session->userdata('id');