CodeIgniter Forums
Routing Question - 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: Routing Question (/showthread.php?tid=12115)



Routing Question - El Forum - 10-06-2008

[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


Routing Question - El Forum - 10-06-2008

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



Routing Question - El Forum - 10-07-2008

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


Routing Question - El Forum - 10-15-2008

[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