0

I have a PHP CodeIgniter Controller with name index and have a method that get details of id kode ($kode) using API get method.

Now when i need to show kode data for example for id AALI I call this URL http://www.example.com/?q=AALI

My target How to make user data accessible by next URLs http://www.example.com/AALI

I've try using function _remap on code Igniter, but it still wont work.

Miskunn
  • 3
  • 4

1 Answers1

0

Have a look at Codeigniter URLs

As per your statement, your controller name is index and there would be an index function in your controller which renders the default view. it means you have changed default_controller to index in your Config.php

Now if you read the link above about Codeigniter URLs, there is a way to get data which passed in the URL after "/" You have to load url helper you can either autoload(recommended) it or load it in your constructor or Controller as per your convenience

Then you can just type

$param=$this->uri->segment(2); // in case your URL is http://www.example.com/AALI

The first segment is controller itself, The second is the function if your url is complete and the third is the parameter in CI URL structure but if you are not providing function name the first segment will always be your controller . So the second is your parameter. Just save it in a variable and do what you like.

Mudassar Khani
  • 1,469
  • 1
  • 20
  • 39