Welcome Guest, Not a member yet? Register   Sign In
Random segment 1? possible?
#1

[eluser]Unknown[/eluser]
Hi guys

Is it possible to have a random 1st segment in the uri?

mysite.com/index.php/234087asdiuhasd_anything_here_as0987asda0sd

Some sort of catch, I'm not sure.

Any help appreciated Big Grin

Cheers
#2

[eluser]xwero[/eluser]
Yes it's possible you use a route to catch whatever you need to display on the page
Code:
$route['(.)+'] = 'controller/method/$1'
#3

[eluser]Unknown[/eluser]
Hey thanks xwero Big Grin, I still a little stuck...

Is it possible for it to preserve the existing controller classes..

So for example look for the controller with the uri name, if there isn't one THEN apply that route rule..before it gives a 404?

Thanks
#4

[eluser]xwero[/eluser]
Because you want a catch all route the only way to use controllers is to use a regular expression or with all your controllers in before the catch all.
Code:
$route['(controller1|controller2)/(.)+'] = '$1/$2';
$route['(controller1|controller2)'] = '$1';
$route['(.)+'] = 'controller/method/$1';




Theme © iAndrew 2016 - Forum software by © MyBB