Welcome Guest, Not a member yet? Register   Sign In
Simple routing issue
#1

[eluser]EEssam[/eluser]
Hello,

I need my articles to be working directly through my domain:
Code:
www.mysite.com/some-title-here
That why I have in my routing file:
Code:
$route[':any'] = "article";
But I have other controllers that I want to exclude.

So my question is how can I exclude a list of controllers? I believe I should use Regular Expressions but I don't know how.

Your help would be greatly appreciated.
#2

[eluser]Thorpe Obazee[/eluser]
I am a noob at regex but this is my try

Code:
$route['^(?!controller|controller|controller)\S*'] = "article/$1";

where 'controller' is the controller(s) that you want to exclude.
#3

[eluser]TheFuzzy0ne[/eluser]
One solution is to simple add a route for each controller, and a catch-all route at the end which will pass any non-matching requests through to your article controller. Another solution is to have the routes dynamically generated on each request, and have your script check that the controller actually exists first.
#4

[eluser]EEssam[/eluser]
[quote author="TheFuzzy0ne" date="1244639763"]have the routes synamically generated on each request, and have your script check that the controller actually exists first.[/quote]Great!

Thanks guys.
#5

[eluser]TheFuzzy0ne[/eluser]
Whoops, that was meant to be "dynamically".




Theme © iAndrew 2016 - Forum software by © MyBB