Welcome Guest, Not a member yet? Register   Sign In
Want to route everything to the same controller except specific urls
#1

[eluser]supermogx[/eluser]
I'm trying to use the routes to route every URLs to the same controller except for specific URLS.

For example, these URLS
/user/[anything here]
/profiles/[anything here]
/abc/[anything here]
/def/[anything here]

should not be routed to the "main" controller. But every other URLs should.

I tried :
$route['/^(/user/|/profiles/|/abc/|/def/)$/i'] = "/main";
but it doesn't seems to work.

EDIT:

I also tried :

$route['^((?!user|profiles|abc|def).)*$'] = "/main";

it almost works. But I'm not able to add the "/" at the beginning and at the end of the words. either :
$route['^((?!\/user\/|\/profiles\/|\/abc\/|\/def\/).)*$'] = "/main";
nor
$route['^((?!/user/|/profiles/|/abc/|/def/).)*$'] = "/main";
works.




Theme © iAndrew 2016 - Forum software by © MyBB