[CI]URL parameter in Codeigniter separated by slashes

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
babyskill
Forum Newbie
Posts: 7
Joined: Tue Jan 19, 2010 10:07 am

[CI]URL parameter in Codeigniter separated by slashes

Post by babyskill »

In my project, I am passing parameters through URL like,

http://site.org/project/controllername/ ... &type=free

What I want is to change the URL to

http://site.org/project/controllername/function/1/free

Is there any method to do this in Codeigniter without using htaccess. I tried adding

Code: Select all

$route['(:any)'] = 'controllername/function/$1';
in application/config/routes.php file. But it returned
404 (Page Not Found)
Error.

Can anyone help me to achieve this. Thanks in advance.
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: [CI]URL parameter in Codeigniter separated by slashes

Post by pbs »

you just need to change the config.php file

check this variable, change it to true

Code: Select all

$config['enable_query_strings'] = TRUE;
also check this URL for more details
http://ellislab.com/codeigniter/user-gu ... /urls.html
Post Reply