drozdo
drozdo

Reputation: 515

Passing GET parameters through htaccess + Codeigniter

I am using CodeIgniter Framework with this .htaccess command for "nice urls".

RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php?$1 [L]

All URLs, for e.g.:

But question is: How can I pass $_GET paramaters? For Example:

I need use GET params od external ajax scripts (f.e.: ElFinder based on CODEIGNTER)

Thanks for advices


Edit:
I solved this problem just using POST method at Elfinder: Elfinder - Request type
But btw using $_GET params in codeigniter with mark "?" with this .htaccess, is impossible

Upvotes: 0

Views: 470

Answers (1)

Malachi
Malachi

Reputation: 33710

Have you read through the CodeIgniter documentation on URI segments?

It explains how you could pass through your action and time parameters.

For example example.com/admin/xxx/die/now would match up to the Controller

class Admin extends CI_Controller {

    public function xxx($action, $time) {
        // Stuff
    }

}

Alternatively as @War10ck suggested you could Use the Input class to get the required $_GET parameters. e.g.

class Admin extends CI_Controller {

    public function xxx() {

        $action = $this->input->get('action');
        $time = $this->input->get('time');

    }

}

Upvotes: 1

Related Questions