title: PHP MVC Redirect to the same page with user friendly URL
body: <p>I am implementing a PHP application using the MVC pattern. At the time being the application is really at the beginning (just to verify that all is running as expected) but, the problem is this:</p>
  
  <p>The site which starts with the usual <code>index.php</code> file (the entry point of the application), when it is contacted (through the URL <code>http://localhost/www/whours.com/</code>) do not show any parameter as query string.
  Since I need that the starting URL shows the default controller and action after <code>whours.com/</code> as user friendly way, I tried to implement a redirect in the <code>index.php</code> to itself concatenating the default controller and action name. 
  After the redirect the page will contact the class <code>Application</code> and then the routing class.</p>
  
  <p>However, the redirect does not work as expected and the URL continue to be:</p>
  
  <pre><code>localhost/www/whours.com/
  </code></pre>
  
  <p>instead I would like to obtain:</p>
  
  <pre><code>localhost/www/whours.com/login_controller/noAuth/
  </code></pre>
  
  <p>Do you have any idea on how to implement this on the entry point page?</p>
  
  <p>Just for your information, the application is doing this:
  In the <code>index.php</code> it sets the autoloader, import all the configuration (mainly a series of define), instantiate the <code>Application</code> class and then call the method run.</p>
  
  <p>The method run will instantiate and call the router which parse the URL and contact the controller. The controller will contact the model (if necessary - of course if the user is not still authenticated no model will be contacted) and the view to render the proper page. But currently no URL can be parsed since I can't obtain to have at the start up of the page the URL with the parameter in the URL.</p>
  
  <p>Here below the code of my index (if it could be necessary):</p>
  
  <pre><code>// Getting the absolute root path
  define('ROOT', dirname(__FILE__) . DIRECTORY_SEPARATOR);
  
  include_once("App/Core/Config/config.php");
  include_once(CORE_PATH . DIRECTORY_SEPARATOR . "Include/autoloader.php");
  
  $app = new Application();
  
  if (!isset($_SESSION['Initialized']))
  {
      $_SESSION['Initialized'] = 1;
  
      header('location: ' . $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] . '/login_controller/noAuth');
  
  }
  $app-&gt;run();
  </code></pre>
  
  <p>Could you please help me to understan to obtain the URL: </p>
  
  <pre><code>localhost/www/whours.com/login_controller/noAuth/
  </code></pre>
  
  <p>when a user contact the site?</p>
  
  <p>I tried with an header redirect but without success.</p>