CodeIgniter Forums
take out control and view in the url - 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: take out control and view in the url (/showthread.php?tid=12314)



take out control and view in the url - El Forum - 10-14-2008

[eluser]wan19800[/eluser]
does anyone know how to take out control and view in the url structure in codeigniter

ex)
http://www.url.com/control/view/segment3

to

http://www.url.com/segment3


I try .htaccess, it does not work.
any suggestions??


thanks


take out control and view in the url - El Forum - 10-14-2008

[eluser]gon[/eluser]
EDIT:

Try setting a route:

Code:
$routes["(:any)"] = "controller/action/$1";

You only can access one controller and action though.


take out control and view in the url - El Forum - 10-14-2008

[eluser]wan19800[/eluser]
nothing seems to work

I try

$route['search'] = "controller";
$route["(:any)"] = "controller/view/$1";


and I want to pass

http://www.url.com/control/view/segment3

to

http://www.url.com/segment3



the segment3 will not pass value


take out control and view in the url - El Forum - 10-15-2008

[eluser]gon[/eluser]
Using the route I proposed, the argument should be passed to the action, as in a normal URL:

/controller/action/arg1/arg2

in this example the action() method would get 2 params: the values arg1 and arg2.