title: Routing in Codeigniter 3
body: <p>I'm relearning PHP and codeigniter but i can't help but notice how ugly my url looks. </p>
  
  <p>So i have a pages controller: Say lets load homepage.</p>
  
  <p>It would look like this:</p>
  
  <pre><code>public function home(){
  $this-&gt;load-&gt;view('template/header');
  $this-&gt;load-&gt;view('template/navbar');
  $this-&gt;load-&gt;view('pages/home');
  $this-&gt;load-&gt;view('template/footer');
  }
  </code></pre>
  
  <p>I guess thats decent as my url will probably look like this:
  <strong><a href="http://localhost/ProjectName/index.php/pages/home" rel="nofollow noreferrer">http://localhost/ProjectName/index.php/pages/home</a></strong></p>
  
  <p>But whenever i click on a link that involves more data processing for example lets say my home has a list of users and i click on one to view their profile. I ofcourse have to pass something to identify which profile i am to load so my link would look like this:</p>
  
  <p><strong><a href="http://localhost/OnlineStories/index.php/pages/view_userprofile/1" rel="nofollow noreferrer">http://localhost/OnlineStories/index.php/pages/view_userprofile/1</a></strong></p>
  
  <p>In my controller id have:</p>
  
  <pre><code>public function view_userprofile(){
  $userid = $this-&gt;uri-&gt;segment(3);
  //process data then load view
  }
  </code></pre>
  
  <p>I'm not asking for any advanced stuff but i would like to ask simple things to improve my url like correct standard for naming my controller functions. </p>
  
  <p>For example: on previous instances of loading my homepage my function name was <code>view_home</code> now its simply just <code>home</code> so its cleaner.</p>
  
  <p>Maybe i could rename my <code>view_userprofile</code> to simply <code>user_profile</code>.</p>
  
  <p>Anyway is there any better method to passing values from view to controller other than uri segment? its what ive been using so i never gave it much thought. I've seen some use get() but idk if its better than uri segment?</p>
  
  <p>Or should i stick with the uri segment and keep my url as controller/method/parameter?</p>
  
  <p>I haven't really explored post-project polishing in codeigniter so idk if theres a way to polish/change the url(just the name).</p>