title: I am confused while configuring the url using htaccess and php switch
body: <p>I want to write a project with regular files. The index file has a php code where all the files opened in the URL are switches. Like for example:</p>
  <p><strong>index.php</strong></p>
  <pre><code>&lt;?php 
  if(isset($_GET['page'])){
     $current_page = isset($_GET['page']) ? $_GET['page'] : '';
  }else{
      $current_page = 'index';
  }  
  
  $result = str_replace(&quot;.php&quot;,&quot;&quot;, $current_page);  
   
      switch($result){
         case 'welcome':
           include('sources/welcome.php');
         break;
         case 'index':
           include('sources/index.php');
         break; 
         case 'profile':
           // Here is the problem. I want to make Facebook style user profile system
           // But the switch can not see profile username because it is working just for page names not usernames
         break;
      } 
  
  ?&gt;
  </code></pre>
  <p>Like the code in the index.php file, I call the pages with the switch. But everything changes when the user opens the profile page. Because I want to make the profile pages of the members just like Facebook. Like <code>http://www.mywebproject.com/username</code></p>
  <p>My created htaccess is here:</p>
  <p><strong>.htaccess</strong></p>
  <pre><code>RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
  RewriteRule (?:^|/)([\w-]+)/?$ profile.php?username=$1 [L,QSA]
  </code></pre>
  <p>My question is this. How can I call members' profiles with their username in switch.</p>