![]() |
Create dynamic SEO based url without function/controller name - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Create dynamic SEO based url without function/controller name (/showthread.php?tid=49724) |
Create dynamic SEO based url without function/controller name - El Forum - 03-01-2012 [eluser]Was[/eluser] Hello friend, i want to create url something like http://www.mysitename.com/my-dynamic-title so how sholud we can create this instead of creating the URL http://www.mysitename.com/function-name/my-dynamic-title .some one guide me how to do this in codeigniter. thanks Was Create dynamic SEO based url without function/controller name - El Forum - 03-01-2012 [eluser]Aken[/eluser] Seriously, do some of you people not even TRY to learn these things on your own first? http://ellislab.com/codeigniter/user-guide/general/routing.html Create dynamic SEO based url without function/controller name - El Forum - 03-01-2012 [eluser]xeroblast[/eluser] change route to to accept any : $route['(:any)'] = 'controller_name/function_name'; in your controller, class controller_name extends CI { function_name($var) { //process the $var string here; } } Create dynamic SEO based url without function/controller name - El Forum - 03-01-2012 [eluser]Was[/eluser] Hello xeroblast, i have done changes as per your suggestion in routes.php and created the controller with the same code for now but i m getting the following error when executing the code by passing my title in url like http://www.mysitename.com/my-dynamic-title A PHP Error was encountered Severity: Warning Message: Missing argument 1 for controller_name::function_name() Filename: controllers/controller_name.php Line Number: 4 Thanks Was Create dynamic SEO based url without function/controller name - El Forum - 03-01-2012 [eluser]xeroblast[/eluser] sorry about that : $route['(:any)'] = 'controller_name/function_name/$1'; Create dynamic SEO based url without function/controller name - El Forum - 03-01-2012 [eluser]Was[/eluser] Thanks Xeroblast its perfect. Was |