Codeigniter routes with GET variables

I am trying to use routes to redirect URLs with GET variables as follows:

$route['^(beautified-link)'] = "controller/function?param=6";

But he does not consider it. Please suggest

+4
source share
4 answers

I'm not sure about this, but you can try by changing these values ​​in the configuration file.

$config['uri_protocol'] = "PATH_INFO"; 
$config['enable_query_strings'] = TRUE; 

and try accessing the url like

$this->input->get(‘param’);
0
source
$route['^(beautified-link)'] = "controller/function";

I think that this can be done only by specifying the controller and method, it is not necessary to maintain the route for passing the GET variable.

0
source

get?

URL config/autoload.php

$autoload['helper'] = array('url');

URL-,

http://example.com/controller/function/param

param , ,

$var=$this->uri->segment(3);

$var=$this->uri->segment(4);//depend of number of "/" that you put on the url
0
source

you need to include the query string in the configuration file.

$config['enable_query_strings'] = TRUE; 
0
source

Source: https://habr.com/ru/post/1531564/


All Articles