Remove controller name from url

#11
[eluser]Matthew Pennell[/eluser]
[quote author="Giacomo" date="1191163399"][quote author="Buddy Bradley" date="1191151815"]
Code:
$routes['([a-z\_]+)$'] = "welcome/$1";
[/quote]
Just another question: what about if i want to match all except one string?

I tried with:
Code:
$routes['([a-z\_]+)^string$'] = "welcome/$1";
But it doesn't work.[/quote]
I can't remember how to do negation in regular expressions, and my cribsheet is at work. The easiest thing to do would be to set up a more specific route that matched the exception:
Code:
$routes['^string$'] = "welcome/specific_method";
$routes['([a-z\_]+)$'] = "welcome/$1";

#12
[eluser]frenzal[/eluser]
the first one doesnt even need to be regex, routes don't overwrite each other so what ever "applies" first will be used


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.