.htaccess – PHP MVC can't get aother value-ThrowExceptions

Exception or error:

I use this code for htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^ index.php [QSA,L]

And this is for set contorller :

protected function prepareURL() {

    $request = trim(str_replace(FOLDER, "", $_SERVER['REQUEST_URI']), '/');
    if(!empty($request))
    {
        $url = $this->filterURL(explode('/', $request));
        $this->controller = isset($url[0]) ? $url[0].'Controller' : 'homeController';
        $this->action = isset($url[1]) ? $url[1] : 'index';

        unset($url[0], $url[1]);

        $this->params = !empty($url) ? array_values($url) : [];
    }
}

This works fine, but if I want to get another value with $_GET does not work for me.

Like:

/course/listen/?page=1

$_GET['page'] does not return 1 and only $_SERVER['REQUEST_URI'] working

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *