In my index.php
(which is in my project root directory) I have a basic routing system that grabs the url (using $_SERVER[‘REQUEST_URI]
) and calls the proper ‘controller’ which then calls the proper ‘view’ (so, implementation of very basic MVC). What I have in my index.php
looks like this:
$router= Router::load('Routes.php');
$uri=trim($_SERVER['REQUEST_URI'],'/');
require $router->direct($uri);
Problem is, I can not seem to make all requests go to index.php
.
Obviously if you go to localhost/myproject/
you will get to index.php
(therefore the proper controller will be called), however what I want is that even if you type localhost/myproject/contact
to first be direct to index.php
. So that index.php
can handle routing for you.