Welcome Guest, Not a member yet? Register   Sign In
Routing Question
#1

[eluser]gungbao[/eluser]
Dear CI-Lovers Smile

I have a question regarding an elegant solution about "routing".

Think about my app as:

controllerA/actionA
controllerA/actionB

controllerB/actionA
...

Do you see a simple and out-of-the box routing definition to have
e.g.

.tld/676787

rransparently routed on
controllerA/actionA/676787

without any redirection. do I have to use mod_rewrite or can I do this in CI itself.

Your hint is higly appreciated,
greetings
chris
#2

[eluser]Colin Williams[/eluser]
Code:
$route['tld/(.*)'] = "controllerA/actionA/$1";
#3

[eluser]gungbao[/eluser]
perfect, easy, helpful - thanks a lot!
#4

[eluser]gungbao[/eluser]
new question:

Code:
$route['(.*)'] = "controllerA/actionA/$1";


does route anything to controllerA, actionA giving actionA-first parameter alle the $1.

this works wonderful for

domin.com/my-first-blog-entry
domin.com/my-second-blog-entry

...

now, I want to keep this rule for any-URL that does not match my controllerB
how can I negate controllerB from beeing matched from the route-rule?

Code:
$route['^(^controllerB)(.*)'] = "controllerA/actionA/$1";

won't work and i cannot find the correct posix-regex... stupid me Smile

pls. could anyone help me?
greetings to all,
christoph




Theme © iAndrew 2016 - Forum software by © MyBB