CodeIgniter: Route Everything, except these Controllers
There was a recent post on the codeigniter forums trying to get urls like these:
http://yoursite.com/your-slug
This problem could have been easily resolved using this route:
$rout['(:any)'] = 'articles/$1';
In this route, all characters after the domain will be passed to the controller, 'article'.
However, the problem was he also had some controllers that he didn't want to use the route for. A quick fix for the route was to use a 'simple' regex using negative lookahead
$route['^(?!controller|controller|controller)\S*'] = "article/$1";
Categories: Web Development
Tags: codeigniter, php
1 Comments


r0n9
$route[’^((?!controller|controller|controller)\S*)’] = “article/$1”;
July 1st 2009