The way I implemented this was to extend \Fuel\Core\Router using the following. The router class works with a URI that passed through the methods from security.uri_filter from config.php , so instead of modifying the methods of the router class, I had an extension of my router, add a callback to this array.
class Router extends \Fuel\Core\Router { public static function _init() { \Config::set('security.uri_filter', array_merge( \Config::get('security.uri_filter'), array('\Router::hyphens_to_underscores') )); } public static function hyphens_to_underscores($uri) { return str_replace('-', '_', $uri); } }
You can simply add it directly to the configuration array in app/config/config.php by closing or calling a class or function method.
The disadvantage of this is that both the actions / path _to_controller / action and / path-to-controller / action will work and possibly cause some problems with duplicate content if you do not specify this to the search spider. This assumes that both paths link somewhere, for example, to a sitemap or to <a href=""> , etc.
source share