I use codeigniter to create a search page. I would like to rewrite the GET URL to work with CI.
Example
http://mysite.com/en/search?search=widgets
becomes
http://mysite.com/en/search/widgets
I thought I could do it in route.php, but it doesn't seem to grab the material after. "So now I think I'm rewriting in .htaccess. Is this a good idea? What will be the rewriting rule?
You should use only the CI routing protocol. Anyway, if you want to use .htaccess, this is:
RewriteEngine On RewriteRule ^en/search/([a-z]+) /en/search?search=$1 [L]
$route['en/search/(:any)'] = "en/search/$1";
Basically, this reassigns something using / en / search / something for the class, search method and search query will be passed as a parameter.
: , , , , , .
$searchtext = $this->url->segment(2);
should get the value "widget" in codeigniter. (Sorry if I had a question wrong).