0

Good Day Friends I am working on Codeigniter Site. I have a url like this

http://localhost/index.php/Medical/college/in/haryana

but i want

http://localhost/index.php/medical_college_in_haryana

Is it possible.

What I have tried

$route['medical/(:any)/(:any)'] = 'medical_$1_in_$2';
Cool Perfectionist
  • 205
  • 1
  • 3
  • 18

2 Answers2

0

Your condition doesn't match because it's not case insensitive.

$route['(?i)medical/(:any)/(:any)'] = 'medical_$1_in_$2';

the (?i) says to match Medical, mEDiCal, etc.

Ohgodwhy
  • 49,779
  • 11
  • 80
  • 110
0

try this

$route[':any'] = 'controller/method';

in function

$var = explode("_", $this->uri->segment(1));
print_r(current($var));
parth
  • 1,803
  • 2
  • 19
  • 27