[eluser]Unknown[/eluser]
I know about the stacking, the problem is using (:any)/(:any) = $2 if the url is one/two/three the match is found but it doesn't route to two/three, just shows 404 (I have controller two with function three). If I write (:any)/(:any)/(:any) = $2/$3 it forks for one/two/three and is routed to two/three.
Also I noticed if I put:
Code:
$route['(:any)/(:any)'] = '$2';
$route['(:any)/(:any)/(:any)'] = '$2/$3';
And the url is one/two/three, the match is found in the first line and as I said above shows 404, but if it is:
Code:
$route['(:any)/(:any)/(:any)'] = '$2/$3';
$route['(:any)/(:any)'] = '$2';
and again one/two/three the match is found in the first line and I'm routed to two/three.
Shouldn't the second "any" reference to all of what is left not just the first segment?
I could just write like 7 lines starting with 8x(:any) and to the last one with 2x(:any), then I could have max 7 segments (1 for controller, 1 for function and 5 for parameters) and if I would need more I could just add extra line but I thought it could be done in a more "appealing" way, I've spent like 2 days to get some alternative, maybe its not worth the effort...
I tried using .htaccess too but I guess I suck at it, I wrote:
Code:
RewriteRule (.*)/(.*) index.php?/$2
, idk what's wrong there but url one/two is interpreted like index.php?/one, but while testing I tried:
Code:
RewriteRule (.*)/(.*) index.php?/$1/smth/$2
and here one/two => index.php?/one/smth/two, so $1=one and $2=two, but in the previous one $2=one
I'm creating something like little blogging system, and the extra segment is for users blog name, for example user A has a blog "hello" and user B has a blog "world", user A would go to example.com/hello to see his blog and user B would go to example.com/world, but they would use the same CI controllers, for example: example.com/hello/comment/add/123 would add a comment to A users blog post with id 123, but example.com/world/comment/add/456 would add a comment to B users blog.
I don't know how many controllers I will have, just started to work on it

Yeah I'm aware about name collision, I'm thinking about using hooks, extending ci_controller or something like that to check if there is a blog with that name in the db.
Well anyway, thank you for your response