i have problem in codeigniter routes.
i want change url from:http://example.com/test/news_details?id=17 to http://example.com/test/funy-url-maker or http://example.com/funy-url-maker
i can make $route dynamicly but it don't work. my code:
$route[rawurlencode("'" . str_replace(' ', '-', $string)) . "'"] = "test/news_details?id=" . $id;
i print route and all route's will be add perfectly, but when i want to open http://example.com/test/funy-url-maker i will be redirect 404 page :(
any idea?
note: when i use this as static it work perfectly.like:
$route[rawurlencode('funyNews')] = "test/b_news";
$stringvariable - CodeGodierequire_once (BASEPATH . 'database/DB' . EXT); require_once (BASEPATH . 'helpers/url_helper' . EXT); require_once (BASEPATH . 'helpers/text_helper' . EXT); $db = &DB(); $query = $db -> get('news'); $result = $query -> result(); foreach ($result as $row) { $route[rawurlencode("'" . str_replace(' ', '-', $row->subject)) . "'"] = "test/news_details?id=" . $row->id; }here you are :) - QuestionMarkvar_dumpresults of your$resultvariable? - CodeGodie