2

I am working on Codeingiter and have a Function in one of my class.

class Search extends My_Controller{

  public function index(){
    //my search code here...
  }

}

Now for this function i need set a route so i can make the URL look like

 http://example.com/s/?q=searchtext

or

 http://example.com/s/#q=searchtext

However when i do this :

$route['s/?q=(:any)'] = "search/index";
$route['s/#q=(:any)'] = "search/index";

It does not work and i am being redirected to 404 page.

It seems CI does not allow this kind of Routing. Please tell me how i can do this.

Also If i use http://example.com/s/#q=searchtext

how can i get the value searchtext in my function ?

Mohan
  • 4,677
  • 7
  • 42
  • 65
  • 4
    The hash is never sent to the server.You can get idea from this http://stackoverflow.com/questions/8192742/what-is-the-meaning-of-in-url-and-how-can-i-use-that – Shaiful Islam Jan 22 '15 at 11:41

0 Answers0