• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
306 route error

#1
CI 3.0.6

in config/route.php
$route['(:any)'] = "site/$1";

in application/site/Someclass.php
and declared index(), somefunction()

when I loading host/someclass it's load index function ok. but host/someclass/somefunction not works. it's shows 404.

is there any error or something? or ?
Reply

#2
It was worked fine in 2x
Reply

#3
I believe :any has changed to not support multiple segments in CI3. So, that route is only getting the first segment, I believe. You can use a regular expression to capture absolutely everything. Something like:

Code:
$route['(.+)'] = "site/$1";
Reply

#4
(03-29-2016, 10:34 PM)kilishan Wrote: I believe :any has changed to not support multiple segments in CI3. So, that route is only getting the first segment, I believe. You can use a regular expression to capture absolutely everything. Something like:

Code:
$route['(.+)'] = "site/$1";

thank you. but when in config $route['api/(:any)'] = "api/$1"; then host/api/someclass/somfunction/var1/var2.... its working.
Reply

#5
$route['(:any)/(:any)'] = "site/$1/$2";
$route['(:any)'] = "site/$1";
Have you try this? I'm not sure it's working.
Keep calm.
Reply

#6
(03-29-2016, 11:49 PM)arma7x Wrote: $route['(:any)/(:any)'] = "site/$1/$2";
$route['(:any)'] = "site/$1";
Have you try this? I'm not sure it's working.

$route['admin/(.+)'] = 'admin/$1';

$route['(.+)'] = "site/$1";

it's working.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.