PHP - Get REQUEST_URI from current route

0

I'm trying to do a "Framework" , I try to get the path that the user requests from the current directory using the Mod Rewrite, with a .htaccess redirect the user to index.php (Tal as the well-known frameworks do), I tried to use $ _SERVER ['REQUEST_URI'] but it also shows me the name of the directory, example:

With the route: link

$_SERVER['REQUEST_URI'] <= MiFramework/MiRuta/Parametros

And what I would like to obtain is:

MiRuta/Parametros
    
asked by geaClash 17.02.2017 в 23:07
source

1 answer

2

You can do it with PATH_INFO

    if (isset($_GET['PATH_INFO'])){
        $peticion = explode('/', $_GET['PATH_INFO']);
    }else{
        $peticion = "Nada que mostrar";
}

Then you read the request, where you will have in each part the different components of the route.

    
answered by 17.02.2017 в 23:20